【问题标题】:Using osmosis to convert POSTGIS Table to .OSM使用 osmosis 将 POSTGIS Table 转换为 .OSM
【发布时间】:2013-02-24 03:32:01
【问题描述】:

我正在使用 osmosis 0.42 和 PostGIS 2.0.1,我正在尝试将一些 postGIS 表导出到 .OSM xml 文件。

我正在使用 --read-pgsql 命令从 postgis 读取(而不是 --read-apidb,因为它在连接到数据库时会引发错误)..

不幸跑了:

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

有什么想法吗?

非常感谢!

美联储

【问题讨论】:

    标签: xml openstreetmap postgis osmosis


    【解决方案1】:

    问题是--read-pgsql 产生一个数据集,但--write-xml 需要一个实体流

    在这两个步骤之间使用--dataset-dump将数据集转换为实体流:

    osmosis --read-pgsql host="x" database="x" user="x" password="x" --dataset-dump --write-xml file="myfile.osm"
    

    【讨论】:

      【解决方案2】:

      要获得一个有限的区域:

      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 cannot be cast to org.openstreetmap.osmosis.hstore.PGHStore”之类的错误,请记住使用最新的 osmosis

      【讨论】:

        【解决方案3】:

        尽管我在 postgis 中的数据具有“快照”模式,但我还没有找到解决方案。

        我在http://marcusjenkins.com/maps/plumbing-with-openstreetmap-osmosis/找到了解决方案

        解决办法是: osmosis --read-pgsql host="localhost" database="foo" user="foo" password="foo" outPipe.0=pg --dd inPipe.0=pg outPipe.0=dd --write-pbf inPipe .0=dd 文件=wherever_munged.osm.pbf

        【讨论】:

          【解决方案4】:

          问题是您的数据库不是 Osmosis 能够理解的格式。 Osmosis 只支持几种模式,因此您需要编写一个自定义导出器。

          【讨论】:

            猜你喜欢
            • 2023-03-18
            • 1970-01-01
            • 2022-06-14
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2013-10-03
            • 2020-07-30
            • 2023-03-04
            相关资源
            最近更新 更多