I am using pgRouting on OpenStreetMaps to create drive time polygons. The challenge is that at state boundaries, these polygons effectively stop, since the roads in OSM are segmented at the state level.

Does anyone have a recommended solution for overcoming this challenge?

  • Roads in OSM do not stop at state or country borders. This is either a rare case or must be a limitation of the data extract your are using.
    – scai
    May 27, 2016 at 11:31

2 Answers 2


Find the state border in OSM (http://www.openstreetmap.org), make the required edits so the roads snap and then reimport the data. Normally they already snap at borders, so you must have been unlucky.


suppose that in your edge_table you have a column state_id

SELECT * from pgr_dijkstra('
  SELECT id, source, target, cost, reverse_cost from edge_table 
    WHERE state_id = 16' 
  <rest of you parameters>);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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