I'm using a PGRouting database originally built with osm2pgrouting from a *.osm file downloaded from Mapzen.

If I want to update the OSM data in that database, ie. re-build my PGRouting Database, what's the best workflow to accomplish this?

Also: I'm not married to the manual download of the *.osm file, so a solution involving osm2pgsql would be fine with me too.

  • I'm currently trying to work on the same thing. I have yet to find a working solution, but I suspect it is something along the lines of: obtain preliminary osm.pbf -> osm2pgsql -> (change sets can be applied here with Osmosis --read-replication-interval) -> back to a (changeset-applied) osm.pbf from PostGIS with osmosis --read-psql -> then finally use osm2pgrouting with a drop option. Essentially, you use osm2pgsql and osmosis to handle changesets to a non-pgRouting OSM PostGIS table, and then create a new osm.pbf to re-create your pgRouting topology from scratch each update. – alphabetasoup Jun 4 '15 at 3:00
  • However I can't actually get this to work, and examples are thin on the ground. Please update this question if you make any progress. – alphabetasoup Jun 4 '15 at 3:02
  • @alpha-beta-soup would the 'clean' option work? I'm going to pull the trigger on that soon just to see if it works - according to pgrouting.org/docs/tools/osm2pgrouting.html, clean will " drop peviously created tables" – DPSSpatial_BoycottingGISSE Jun 4 '15 at 17:13

Turns out the 'clean' option does the trick, as per the osm2pgrouting documentation waaaay at the bottom:

all available parameters are:

-file -- name of your osm xml file
-dbname -- name of your database
-user -- name of the user, which have write access to the database
-conf -- name of your configuration xml file

-host -- host of your postgresql database (default:
-port -- port of your database (default: 5432)
-passwd -- password for database access
-clean -- drop peviously created tables

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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