Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Find edges covered by polygon

The contextSubscription call already uses an efficient data structure for spatial lookup so there is not much room for improvement on the algorithmic side.
However, you probably will not get the expected results because it checks for the distance between the edge shape and the polygon outline and would thus could miss edges in the interior of the polygon.
The tool edgesInDistrict.py also checks the interior but isn't terribly efficient (it tests every edge against every polygon). You could speed up your computation by calling the script multiple times in parallel for different polygons.



Am So., 14. Juni 2020 um 15:20 Uhr schrieb marcelreppi <marcelreppi@xxxxxxxxx>:
Hello,

I have many polygons in my simulation and I need to know which edges are
covered by them.
Currently I am using the following to do that:

traci.polygon.subscribeContext(pid, tc.CMD_GET_EDGE_VARIABLE, 0,
[tc.ID_COUNT])
polygon_context = traci.polygon.getContextSubscriptionResults(pid)
traci.polygon.unsubscribeContext(pid, tc.CMD_GET_EDGE_VARIABLE, 0)

For small scenarios this is fast enough but for very big networks and a lot
of polygons this approach is extremely slow.
Is there maybe better way of doing it?

Thanks!

Best regards
Marcel



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top