0

Is it possible to set the target database schema using osm2pgrouting?

After some debate and troubleshooting, I've decided to host my OSM-based pgRouting data in the same database as the rest of my data, but want to use a different schema (one big issue was using dblink, which I can't get to work anyway).

However, osm2pgrouting doesn't expose the ability to specify the target schema.

  • 1
    I added the feature request to osm2pgrouting – Vicky Jul 18 '15 at 12:55
  • @Vicky that's great! I much appreciate that!!! – DPSSpatial Jul 18 '15 at 15:27
2

Only way I've been able to do it (I think it works for osm2pgrouting, but haven't tried recently)

Is to first change the search_path of your database temporarily so preferred schema is first:

ALTER DATABASE yourdb SET search_path = osm_data, public;

Then run osm2pgrouting

Alternatively you could create a user specifically for loading and then set the search_path for that user (or name the same as the schema) assuming you didn't mess with your db search_path.

ALTER ROLE osm_user IN DATABASE yourdb
     SET search_path = osm_data,public;

then always load with that user.

It's not ideal I know. Probably worthwhile putting in a feature request here: https://github.com/pgRouting/osm2pgrouting

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.