[Tile-serving] [osm2pgsql-dev/osm2pgsql] Use osm2pgsql to prepare data that can be imported in a routing service (Discussion #2145)

Jochen Topf notifications at github.com
Mon Mar 25 08:52:07 UTC 2024


As pnorman said the job of osm2pgsql is normally to do a lossy transformation of OSM data into some format better suited for the use case. That being said, osm2pgsql also has the "middle" tables (usually needed for updates) which contain all the OSM raw data.  I do have some experimental code to turn those middle tables back into an OSM file. So you could use osm2pgsql to just import the middle tables, do some processing on them and write them out again. But with this approach you can only output modified OSM data, not completely new data, or the same road centerline several times, because the ids would clash.

It would, of course, be possible to generate a completely "fake" OSM file from the data in an osm2pgsql table, but that would involve writing code to turn geometries back into nodes and all that. Doable, but a rather cumbersome way, especially if you want to use that in something like OSRM which will have to reverse that.

Is it important that you do the routing in an external program? Another option would be to use pgRouting. I have thought about an osm2pgsql add-on program that would generate a routing graph, that's something a lot of people have asked for. There are some import tools for OSM to a database for pgRouting, but from what I have seen they are not that great/maintained.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2145#discussioncomment-8899479
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/repo-discussions/2145/comments/8899479 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20240325/5e531dcc/attachment.htm>


More information about the Tile-serving mailing list