2013-03-08 44 views
3

我使用的是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

回答

0

問題是您的數據庫不是Osmosis能夠理解的格式。只有Osmosis支持的幾種模式,因此您需要編寫一個自定義導出器。

0

儘管我在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

0

要獲得一個有限的區域:

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」

0

的問題是,--read-pgsql產生數據集,但--write-xml預計實體流

使用--dataset-dump這兩個步驟之間的數據集轉換爲實體流:

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