| 21 | | required: |
|---|
| 22 | | -file <file> -- name of your osm xml file |
|---|
| 23 | | -dbname <dbname> -- name of your database |
|---|
| 24 | | -user <user> -- name of the user, which have write access to the database |
|---|
| 25 | | -conf <file> -- name of your configuration xml file |
|---|
| 26 | | optional: |
|---|
| 27 | | -host <host> -- host of your postgresql database (default: 127.0.0.1) |
|---|
| 28 | | -port <port> -- port of your database (default: 5432) |
|---|
| 29 | | -passwd <passwd> -- password for database access |
|---|
| 30 | | -clean -- drop peviously created tables |
|---|
| | 29 | Then compile |
|---|
| | 30 | {{{ |
|---|
| | 31 | cd osm2pgrouting |
|---|
| | 32 | make |
|---|
| | 33 | }}} |
|---|
| | 34 | |
|---|
| | 35 | == How to use == |
|---|
| | 36 | |
|---|
| | 37 | 1. First you need to create a database and add PostGIS and pgRouting functions: |
|---|
| | 38 | {{{ |
|---|
| | 39 | createdb -U postgres osm |
|---|
| | 40 | createlang -U postgres plpgsql osm |
|---|
| | 41 | |
|---|
| | 42 | psql -U postgres -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql osm |
|---|
| | 43 | psql -U postgres -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql osm |
|---|
| | 44 | |
|---|
| | 45 | psql -U postgres -f /usr/share/postlbs/routing_core.sql osm |
|---|
| | 46 | psql -U postgres -f /usr/share/postlbs/routing_core_wrappers.sql osm |
|---|
| | 47 | psql -U postgres -f /usr/share/postlbs/routing_topology.sql osm |
|---|
| | 48 | }}} |
|---|
| | 49 | |
|---|
| | 50 | 2. You can define the features and attributes to be imported from the |
|---|
| | 51 | OpenStreetMap XML file in the configuration file (default: mapconfig.xml) |
|---|
| | 52 | |
|---|
| | 53 | 3. Open a terminal window and run osm2pgrouting with the following paramters |
|---|
| | 54 | {{{ |
|---|
| | 55 | ./osm2pgrouting -file /home/foss4g/capetown_20080829.osm \ |
|---|
| | 56 | -conf mapconfig.xml \ |
|---|
| | 57 | -dbname osm \ |
|---|
| | 58 | -user postgres \ |
|---|
| | 59 | -clean |
|---|
| | 60 | }}} |
|---|
| | 61 | |
|---|
| | 62 | Other available parameters are: |
|---|
| | 63 | {{{ |
|---|
| | 64 | * required: |
|---|
| | 65 | -file <file> -- name of your osm xml file |
|---|
| | 66 | -dbname <dbname> -- name of your database |
|---|
| | 67 | -user <user> -- name of the user, which have write access to the database |
|---|
| | 68 | -conf <file> -- name of your configuration xml file |
|---|
| | 69 | * optional: |
|---|
| | 70 | -host <host> -- host of your postgresql database (default: 127.0.0.1) |
|---|
| | 71 | -port <port> -- port of your database (default: 5432) |
|---|
| | 72 | -passwd <passwd> -- password for database access |
|---|
| | 73 | -clean -- drop peviously created tables |
|---|
| | 74 | }}} |
|---|
| | 75 | |
|---|
| | 76 | 4. Connect to your database and see the tables that have been created |
|---|
| | 77 | {{{ |
|---|
| | 78 | psql -U postgres osm |
|---|
| | 79 | \d |
|---|
| | 80 | List of relations |
|---|
| | 81 | Schema | Name | Type | Owner |
|---|
| | 82 | --------+---------------------+----------+---------- |
|---|
| | 83 | public | classes | table | postgres |
|---|
| | 84 | public | geometry_columns | table | postgres |
|---|
| | 85 | public | nodes | table | postgres |
|---|
| | 86 | public | spatial_ref_sys | table | postgres |
|---|
| | 87 | public | types | table | postgres |
|---|
| | 88 | public | vertices_tmp | table | postgres |
|---|
| | 89 | public | vertices_tmp_id_seq | sequence | postgres |
|---|
| | 90 | public | ways | table | postgres |
|---|
| | 91 | (8 rows) |
|---|
| | 92 | }}} |
|---|
| | 93 | |
|---|
| | 94 | Note: If tables are missing you might have forgotten to add PostGIS or pgRouting |
|---|
| | 95 | functions to your database. |
|---|
| | 96 | |
|---|
| | 97 | Let's do some more advanced routing with those extra information about road |
|---|
| | 98 | types and road classes. |
|---|