Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to customize osm2po logic in defining possible speed limits of ways. osm2po takes into account only class of road while I need to consider one more parameter: is road inside or outside some city, i.e. for example: speed limit for higway=trunk inside city = 60km/h while outside it should be equal to 90km/h. What is a proper way to implement such logic? Is it feasible at all to do withing osm2po? Or may be it better/easier to load graph data into Postgres/PostGIS using osm2po generated sql-script and do speed/cost corrections there (assuming that we already have all city borders loaded into Postgres/PostGIS db) and use pgRouting as routing engine? Any advices highly appreciated.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Using the osm2po-API, namely overriding de.cm.osm2po.converter.DefaultWayTagResolver.getSpeedInKmh() are 5 lines of code. Nevertheless you need some extra info for the areas. Which way (id) belongs to a city, which one does not? If you only have a set of polygons, you can also override de.cm.osm2po.converter.GraphBuildInterceptor.getKmh(int, boolean) but this influences the creation of the osm2po-graph only, not the pgRouting-table. The advantage here is, that you can query the geometry of each way instead of matching its ID to some external data.

Well, there is a third option, the de.cm.osm2po.converter.DefaultJoinInterceptor which combines both advantages but is very critical to use because it gives you full access to a resolved way before writing it for later conversion steps.

share|improve this answer
    
Thank you, Carsten - I choose the last option and it works fine for me. –  Andrew Aug 6 '13 at 13:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.