Open namdre opened 4 years ago
I have worked on this and I think it is appropriate to share my approach. I will briefly try to explain the method. Given geo-referenced files with detector locations (lat, lon), we need a map matching tool to assign these to the OSM network. I leveraged the shared-streets matcher to match the OSM links with the detector locations. Although the codes I developed are specific to my case study, I think with little formatting they can be applied to other study areas as well. These are the steps:
shst match $SUMO_NETWORK_GEOJSON --out=$SUMO_SS --snap-intersections --follow-line-direction --search-radius=10 --offset-line=1
for detectors:
shst match $DETECTORS_GEOJSON --out=$DETECTORS_SS --snap-intersections --follow-line-direction --follow-line-direction --snap-intersections --search-radius=100 --offset-line=1
If this approach is interesting and according to your plans, I will be glad to share the codes.
Thank you for sharing your approach. I'd appreciate it if you could link you codes so that others may be able to follow those steps. However, It doesn't solve the full problem originally envisioned for this issue:
Here is the link to the repository. I will add a working example and document it better.
Given a file det.csv
of the following form
id;lat;lon
foo;52.432559;13.496612;1000
bar;52.432373;13.496142;500
It can be turned into a file with detectors with:
python tools/detector/mapDetectors.py -n net.net.xml -d det.csv -o det.add.xml
With the mapped detectors and file flow.csv
of the following form
Detector;Time;Count
foo;0;1000
bar;0;500
It can be turned into edgeData (i.e. for routeSampler) with an existing tool:
python3 /scr1/sumo/tools/detector/edgeDataFromFlow.py -d det.add.xml -f flows.csv -o edgedata.xml -q Count -i 60
a nice dataset is found at https://api.viz.berlin.de/daten/verkehrsdetektion This containts lon/lat data with direction information at a granularity of 8 different compass rose directions (i.e. southeasth, south, southwest).
I'm popping by this thread since datasets are being advertised. Here is the one we published while at ETH Zurich/NYU Abu Dhabi: https://utd19.ethz.ch
loop detectors from >40 cities worldwide geo-referenced
What about a map-matching to OSM data? Is that also available? How did you / would you go about it?
It's not matched to OSM, it's only WGS84 coordinates.
The dataset also has a file with a "helper-link", which is a line shp that follows the road in the direction that the detector is measuring flow. So this helper-link can be matched to OSM edges which are closest and in the same direction. And then the lane is the one closest to the SUMO-lane. This helper-link was done by hand, so not really scalable.
@vishalmhjn's approach is interesting. Haven't checked the detector mapping script. But I would transform the SUMO network to a polygon shp with the lanes' width and then match loops to these polygons (over or closest). Also, there is need for a fall-back if there are three loops and three lanes, then all loops should be assigned to a lane, and this isn't necessarily their closest lane. I think, what I did once:
hope that helps.
e.g.:
where dir is a cardinal direction
There are two possible kinds of data output here:
Further thoughts:
Envisioned features: