How to convert OSM Data to PostgreSQL for Routing Purposes?

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.


Also pay your attention to osm2po (http://osm2po.de) - it could generate sql scripts compatible with pgRouting and in some cases it easier to use than osm2pgrouting (for example on MS Windows platform as osm2po is written in Java).