I am using osm2po to populate a pgrouting-compatible table in a postgis enabled database. I changed the table definition a little bit (unlogged table for faster inserts, added indexes on osm_id for faster lookups, clustered on way geometry for faster seeks, ...). I now need to update this table with fresh data. Can I somehow tell osm2po to not include DDL statements to create the table ? Also, can the INSERT statements be changed to COPY for faster inserts ?

My current solution is to tail -n +13 osm\osm_2po_4pgr.sql to strip the first rows. It's OK, but not the best solution. As for the COPY statements, I have no solution yet (replacing in the file would not be worth the computing time I believe).

1 Answer 1


Yes, it'll be faster but not readable anymore - hard to debug if errors occur. So I once decided to use the text approach. Anyway, you can review the sources in the plugin's sources which are open and part of the downloaded zip. Look for PgRoutingWriter.java. To get an idea of how to customize binary things in osm2po read this article here: How to extend OSM2PO with ferry durations?

  • Thanks ! I was hoping for a simple configuration setting, but I knew I would probably have to dig into the sources.
    – thewild
    Jun 6, 2017 at 7:12

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.