使用osmosis将POSTGIS表转换为.OSM
我使用的是osmosis 0.42和PostGIS 2.0.1,我试图将一些postGIS表导出为.OSM xml文件。使用osmosis将POSTGIS表转换为.OSM
我使用--read-pgsql的命令(因为它在连接到数据库抛出一个错误,而不是--read-apidb)从PostGIS的阅读..
不幸的是正在运行:
osmosis --read-pgsql host="x" database="x" user="x" password="x" --write-xml file="myfile.osm"
产生以下错误:
Task 2-write-xml does not support data provided by default pipe stored at level 1 in the default pipe stack
任何想法?
非常感谢!
Fede
问题是您的数据库不是Osmosis能够理解的格式。只有Osmosis支持的几种模式,因此您需要编写一个自定义导出器。
尽管我在postgis中的数据有“快照”模式,但我还没有找到解决方案。
我已发现上http://marcusjenkins.com/maps/plumbing-with-openstreetmap-osmosis/
的溶液的解决方案是: 渗透--read-pgsql的主机= “localhost” 的数据库= “foo” 的用户= “foo” 的密码= “foo” 的outPipe.0 = PG --dd inPipe.0 = PG outPipe.0 = DD --write-PBF inPipe.0 = DD文件= wherever_munged.osm.pbf
要获得一个有限的区域:
osmosis --read-pgsql database=egypt-osm user=gisuser password='test0199' outPipe.0=pg --dataset-bounding-box inPipe.0=pg top=30.1332509 left=31.1400604 bottom=29.9400604 right=31.3220215 outPipe.0=dd --write-xml inPipe.0=dd file=- | bzip2 > cairo.osm.bz2
要获得应有尽有:
osmosis --read-pgsql database=egypt-osm user=gisuser password='test0199' outPipe.0=pg --dd inPipe.0=pg outPipe.0=dd --write-xml inPipe.0=dd file=- | bzip2 > everything.osm.bz2
请记住,如果你得到错误使用了最新的渗透像“java.util.HashMap中不能转换为org.openstreetmap.osmosis.hstore.PGHStore”
的问题是,--read-pgsql
产生数据集,但--write-xml
预计实体流。
使用--dataset-dump
这两个步骤之间的数据集转换为实体流:
osmosis --read-pgsql host="x" database="x" user="x" password="x" --dataset-dump --write-xml file="myfile.osm"