pgRouting / osm2pgrouting

Import tool for OpenStreetMap data to pgRouting database
https://pgrouting.org
GNU General Public License v2.0
288 stars 112 forks source link

osm2pgrouting has issues creating tables #243

Closed mhubrich closed 5 years ago

mhubrich commented 5 years ago

Hi all,

I have problems executing osm2pgrouting. I get error messages right at the beginning when the tables are created. Here is what I do:

createdb routing
psql --dbname routing -c 'CREATE EXTENSION postgis'
psql --dbname routing -c 'CREATE EXTENSION pgRouting'

Next, I run:

osm2pgrouting --f Downloads/export.osm --conf osm2pgrouting/mapconfig.xml --dbname routing --username postgres

And get the following output:

***************************************************
           COMMAND LINE CONFIGURATION             *
***************************************************
Filename = Downloads/export.osm
Configuration file = osm2pgrouting/mapconfig.xml
host = localhost
port = 5432
dbname = routing
username = postgres
schema= 
prefix = 
suffix = 
Don't drop tables
Don't create indexes
Don't add OSM nodes
***************************************************
Testing database connection: routing
database connection successful: routing
Connecting to the database
connection success
2018-08-02 16:27:14.466 PDT [8474] ERROR:  extension "postgis" already exists
2018-08-02 16:27:14.466 PDT [8474] STATEMENT:  CREATE EXTENSION postgis

Creating tables...
2018-08-02 16:27:14.484 PDT [8477] ERROR:  relation "ways_vertices_pgr" does not exist at character 8
2018-08-02 16:27:14.484 PDT [8477] STATEMENT:  SELECT 'ways_vertices_pgr'::regclass
TABLE: ways_vertices_pgr created ... OK.
2018-08-02 16:27:14.503 PDT [8478] ERROR:  relation "ways" does not exist at character 8
2018-08-02 16:27:14.503 PDT [8478] STATEMENT:  SELECT 'ways'::regclass
TABLE: ways created ... OK.
2018-08-02 16:27:14.511 PDT [8479] ERROR:  relation "pointsofinterest" does not exist at character 8
2018-08-02 16:27:14.511 PDT [8479] STATEMENT:  SELECT 'pointsofinterest'::regclass
TABLE: pointsofinterest created ... OK.
2018-08-02 16:27:14.520 PDT [8480] ERROR:  relation "configuration" does not exist at character 8
2018-08-02 16:27:14.520 PDT [8480] STATEMENT:  SELECT 'configuration'::regclass
TABLE: configuration created ... OK.
Opening configuration file: osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done 
    Parsing data

Segmentation fault: 11

Does anyone know what's going wrong?

Here some information about my system:

cayetanobv commented 5 years ago

Hi @mhubrich ,

Are you sure your user has permissions? Why don't you supply password? Are you sure you are using version 2.3.6?

Thanks,

mhubrich commented 5 years ago

Hi @cayetanobv, Thanks for your reply.

That's the version output I get:

>> osm2pgrouting --version
This is osm2pgrouting Version 2.3.6

Here is information about the user:

>> psql -U postgres -c "\du"
                                        List of roles
  Role name  |                         Attributes                         | Member of 
-------------+------------------------------------------------------------+-----------
 postgres    | Superuser, Create DB                                       | {}

I didn't supply a password because this user doesn't have one. I think there are no problems of this user accessing the database. The output in my initial post says:

Testing database connection: routing
database connection successful: routing
Connecting to the database
connection success

Tables inside the DB routing were even created:

>> psql -U postgres -d routing -c "\d"
                    List of relations
 Schema |           Name           |   Type   |  Owner   
--------+--------------------------+----------+----------
 public | configuration            | table    | postgres
 public | configuration_id_seq     | sequence | postgres
 public | geography_columns        | view     | postgres
 public | geometry_columns         | view     | postgres
 public | pointsofinterest         | table    | postgres
 public | pointsofinterest_pid_seq | sequence | postgres
 public | raster_columns           | view     | postgres
 public | raster_overviews         | view     | postgres
 public | spatial_ref_sys          | table    | postgres
 public | ways                     | table    | postgres
 public | ways_gid_seq             | sequence | postgres
 public | ways_vertices_pgr        | table    | postgres
 public | ways_vertices_pgr_id_seq | sequence | postgres

However, all tables are empty (except of configuration).

cayetanobv commented 5 years ago

Ok, thanks. It seems is a dataset issue. Could you upload your osm dataset to test it?

mhubrich commented 5 years ago

Thanks a lot! Here is the file I used: export.osm.zip I didn't find any detailed information on how the osm file should look like. I used Overpass-Turbo to create the file.

Do you have an example file for me I could try on my machine?

cayetanobv commented 5 years ago

Hi @mhubrich ,

I tried to use your dataset but I see very strange issues in your geometries. You can see this screenshot from QGIS of your OSM dataset: image

I downloaded your area and it is working fine with osm2pgrouting (screenshot of OSM dataset): image

I think there is something strange in your downloaded dataset. You can try to download with another tools:

Thanks,

mhubrich commented 5 years ago

Thank you so much, @cayetanobv. That explains a lot!

You were a good help here, thanks for your time :)

cayetanobv commented 5 years ago

Thanks to you @mhubrich !