Wednesday, 6 March 2019

Don't route through bollards, concrete blocks, etc with osm2po


Is it possible to prevent road segments being used when these are blocked by bollards, concrete blocks or the like?


I have one example where there the road Solhøjvej is blocked with a so called concrete block as you can see here


http://www.openstreetmap.org/?lat=57.010248&lon=9.936238&zoom=18&layers=M



Here is a photo of the "block":


https://maps.google.com/?ll=57.010343,9.934331&spn=0.000929,0.00284&t=m&layer=c&cbll=57.010252,9.934346&panoid=SrWxGTFwoDbDZeDgXHl8vg&cbp=12,10.73,,0,10.62&z=19


I’m exporting the Openstreetmap to PostgreSQL using osm2po and performs routing, but this does not know of these concrete blocks or bollards or stuff blocking the road.


I’m aware that this is perhaps not a simple task, to detect and split road segments when such obstacles occur, but that would be very useful. Am I just missing an option?



Answer



Yes, it's possible. But osm2po only takes barrier=bollard into account by default. If you need other types of barriers you'll have to use Java in order to override DefaultNodeTagResolver.isBarrier(). For pgRouting this information can be retrieved from the Vertex-Table which is not written by default, but can be activated by setting postp.1.class=de.cm.osm2po.plugins.PgVertexWriter in the config. Once created look for clazz < 0 in the table. Additionally setting sth. like nodeClazz.-128.name=Barriers in the config or on the commandline visualizes them in the WebTestUI (see below)


In osm2po barriers are handled like turn restrictions and must be explicitly activated by setting graph.support.barriers=true.


bollard-barries in Hamburg


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...