osm2pgrouting - 解析数据格式不正确(无效令牌)

时间:2017-01-20 18:36:56

标签: postgresql openstreetmap postgis pgrouting

我需要通过osm2pgrouting工具将开放街道地图数据导入我的PostGIS数据库。但是当我运行命令时,表被创建但没有任何数据。你能告诉我我做错了什么吗?我在我的数据库中安装了扩展pgrouting ...

作为mapconfig,我使用默认的mapconfig.xml,它位于osm2pgrouting工具(C:\ Program Files \ PostgreSQL \ 9.5 \ bin)之类的相同文件夹中。我正在使用Windows操作系统。

E:\>osm2pgrouting -f osm_data.osm.pbf --dbname osm_db --conf mapconfig.xml --clean
Execution starts at: Fri Jan 20 19:24:13 2017

***************************************************
           COMMAND LINE CONFIGURATION             *
***************************************************
Filename = osm_data.osm.pbf
Configuration file = mapconfig.xml
host = localhost
port = 5432
dbname = osm_db 
username = postgres
password =
schema=
prefix =
suffix =
Drop tables
Don't add nodes
***************************************************
Connecting to the database
host=localhost user=postgres dbname=osm_db port=5432
connection success
Opening configuration file: mapconfig.xml
    Parsing configuration

    Parsing data (progress line per 100000 elements)

not well-formed (invalid token) at line 1    Finish Parsing data


Dropping tables...

Creating tables...
Creating 'ways_vertices_pgr': OK
   Adding Geometry: Creating 'ways': OK
   Adding Geometry: Creating 'relations_ways': OK
 Exists: 'osm_nodes': OK
 Exists: 'osm_relations': OK
 Exists: 'osm_way_types': OK
 Exists: 'osm_way_classes': OK
Adding auxiliary tables to database...

Export Types ...
    Processing 4 way types:      Inserted: 0 in osm_way_types

Export Classes ...
    Processing way's classes:    Inserted: 0 in osm_way_classes

Export Relations ...
    Processing 0 relations:     Inserted: 0 in osm_relations

Export RelationsWays ...
    Processing way's relations:          Inserted: 0 in relations_ways

Export Ways ...
    Processing 0 ways:
    Ways Processed: 0       Split Ways generated: 0     Vertices inserted 0 Inserted 0 split ways
Creating Foreign Keys ...
Foreign keys for osm_way_classes table created
Foreign keys for relations_ways table created
Foreign keys for Ways table created
#########################
size of streets: 0
Execution started at: Fri Jan 20 19:24:13 2017
Execution ended at:   Fri Jan 20 19:24:13 2017
Elapsed time: 0.202 Seconds.
User CPU time: -> 0.202 seconds
#########################

Mapconfig:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <type name="highway" id="1">
    <class name="motorway" id="101" />
    <class name="motorway_link" id="102" />
    <class name="motorway_junction" id="103" />
    <class name="trunk" id="104" />
    <class name="trunk_link" id="105" />    
    <class name="primary" id="106" />
    <class name="primary_link" id="107" />    
    <class name="secondary" id="108" />
    <class name="secondary_link" id="124" />
    <class name="tertiary" id="109" />
    <class name="tertiary_link" id="125" />
    <class name="residential" id="110" />
    <class name="living_street" id="111" />
    <class name="service" id="112" />
    <class name="track" id="113" />
    <class name="pedestrian" id="114" />
    <class name="services" id="115" />
    <class name="bus_guideway" id="116" />
    <class name="path" id="117" />
    <class name="cycleway" id="118" />
    <class name="footway" id="119" />
    <class name="bridleway" id="120" />
    <class name="byway" id="121" />
    <class name="steps" id="122" />

    <class name="unclassified" id="123" />
    <class name="road" id="100" />
  </type>
  <type name="cycleway" id="2">
    <class name="lane" id="201" />
    <class name="track" id="202" />
    <class name="opposite_lane" id="203" />
    <class name="opposite" id="204" />
  </type>  
  <type name="tracktype" id="3">
    <class name="grade1" id="301" />
    <class name="grade2" id="302" />
    <class name="grade3" id="303" />
    <class name="grade4" id="304" />
    <class name="grade5" id="305" />
  </type>  
  <type name="junction" id="4">
    <class name="roundabout" id="401" />
  </type>  
</configuration>

1 个答案:

答案 0 :(得分:4)

解决方案是* .osm格式而不是* .osm.pbf。