首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基于postgis的openstreetmap数据过滤

基于postgis的openstreetmap数据过滤
EN

Stack Overflow用户
提问于 2017-07-25 07:51:33
回答 1查看 595关注 0票数 2

我正在创建一个postgis数据库,并希望使用过滤后的OpenStreetMap数据。

为此,我尝试了以下过程:

  1. 从planet.osm.bz2下载https://planet.osm.org/文件
  2. 使用*.osm解压缩到bzip2
  3. 通过命令提示符使用osmfilter筛选文件
  4. 在命令提示符中使用*.osm将过滤后的osm2pgsql文件上载到我的数据库

在我的第一次尝试中,我只过滤了土地面积。

但是,在使用osm2pgsql的步骤4中,我在命令提示符中接收到以下错误:"Osm2pgsql由于错误而失败:第3137102行的XML解析错误,第61列:格式不正确(无效令牌) "

如windows计算机上的命令提示符所示:

代码语言:javascript
复制
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. 使用osmfilter下载planet.pbf ->转换为.o5m的->筛选
  2. 使用osmfilter下载planet.pbf ->转换为.osm,使用osmfilter进行->过滤(给出警告) ->,使用osm2pgsql传输到数据库

有人知道如何避免这个错误,或者有过滤planet.osm文件并上传到postgis的经验吗?

EN

回答 1

Stack Overflow用户

发布于 2017-07-25 14:28:34

我建议使用,而不是osmfilter,它不需要首先将地球转换成不同的格式,并且本机能够返回PBF数据,这些数据可以由osm2pgsql直接处理。它也更快。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45297108

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档