2017-07-25 48 views
2

我正在創建一個postgis數據庫,並且想要使用過濾的OpenStreetMap數據。過濾postgis的openstreetmap數據

爲此,我曾嘗試以下過程:* .osm使用到的bzip2

  1. 下載的文件planet.osm.bz2從https://planet.osm.org/
  2. 解壓縮後的
  3. 過濾使用osmfilter通過命令文件提示
  4. 上傳在命令提示符下使用osm2pgsql過濾的* .osm文件到我的數據庫

對於我的第一次嘗試,我只是過濾了土地面積。

然而,步驟4使用osm2pgsql中,我收到以下錯誤在命令提示:「Osm2pgsql失敗,由於錯誤:不 合式(標記無效) :XML在行3137102,塔61分析錯誤「

作爲從命令提示顯示我的視窗的計算機上:

Z:\OpenStreetMap>osm2pgsql -U postgres -W -m -d osm -p filteredland -S "C:\Progr 
 
am Files (x86)\HOTOSM\share\default.style" filteredland2.osm 
 
osm2pgsql version 0.92.0 (64 bit id space) 
 

 
Password: 
 
Using built-in tag processing pipeline 
 
Using projection SRS 3857 (Spherical Mercator) 
 
Setting up table: filteredland_point 
 
Setting up table: filteredland_line 
 
Setting up table: filteredland_polygon 
 
Setting up table: filteredland_roads 
 
Allocating memory for sparse node cache 
 
Node-cache: cache=800MB, maxblocks=12800*65536, allocation method=1 
 
Mid: Ram, scale=100 
 

 
Reading in file: filteredland2.osm 
 
Using XML parser. 
 
Processing: Node(1230k 61.5k/s) Way(0k 0.00k/s) Relation(0 0.00/s)node cache: st 
 
ored: 1233078(100.00%), storage efficiency: 50.00% (dense blocks: 0, sparse node 
 
s: 1233078), hit rate: -nan(ind)% 
 
Osm2pgsql failed due to ERROR: XML parsing error at line 3137102, column 61: not 
 
well-formed (invalid token)

我還試圖兩個備用路由,這也失敗:

  1. 下載planet.pbf - >轉換爲.o5m使用osmconvert - > 過濾使用osmfilter

  2. 下載planet.pbf - >轉換使用osmconvert到.osm - > 過濾使用osmfilter(都給警告) - >使用osm2pgsql到 傳遞到數據庫

任何知道如何避免這個錯誤,或者有過濾planet.osm文件並上傳到postgis的經驗?

回答

0

我建議使用Osmium而不是osmfilter,它不需要首先將行星轉換爲不同的格式,並且本地可以返回可由osm2pgsql直接處理的PBF數據。它也更快。