[GIS] How to convert OSM Data to PostgreSQL for Routing Purposes

openstreetmappostgisrouting

I'm creating a routing application using OpenStreetMap. Currently, my task is to convert the data from an OSM file to PostgreSQL.

I read about osm2pgsql, but the problem is it says there that osm2pgsql is not suited for routing. I read about Osmosis too, but there is something about rails port, which I think means I need to learn Ruby in Rails. I tried studying RoR in the past and I found it too difficult for me to learn.

I'm using PHP for my application. How can I able to extract the data from the OSM file and export it to my PostgreSQL. I know I might be missing something here, but I'm a newbie when it comes to mapping application. I hope someone can help me. Thanks! 😀

Best Answer

Routing in Postgres / PostGIS is handled by the pgRouting library from http://pgrouting.org

It looks like a script has already been written to handle osm straight into pgRouting at http://www.pgrouting.org/docs/tools/osm2pgrouting.html

You will need to install pgRouting within Postgres before running the osm2pgrouting script.

Related Question