2012-10-30 62 views
2

我試圖導入以下的OpenStreetMap之一123映射到使用像call osmosis.bat --read-xml file="map.osm" --write-pgsimp user="ccp-web-user" database="ccp-web2" password="ccp-web-password"調用PostgreSQL數據庫,但我總是以下錯誤消息。導入OpenStreetMap的數據到PostgreSQL數據庫

SCHWERWIEGEND: Thread for task 1-read-xml failed 
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to read the schema version from the schema info table. 
     at org.openstreetmap.osmosis.pgsimple.common.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:90) 
     at org.openstreetmap.osmosis.pgsimple.common.SchemaVersionValidator.validateVersion(SchemaVersionValidator.java:50) 
     at org.openstreetmap.osmosis.pgsimple.v0_6.PostgreSqlWriter.initialize(PostgreSqlWriter.java:183) 
     at org.openstreetmap.osmosis.pgsimple.v0_6.PostgreSqlWriter.process(PostgreSqlWriter.java:773) 
     at org.openstreetmap.osmosis.xml.v0_6.impl.BoundsElementProcessor.end(BoundsElementProcessor.java:84) 
     at org.openstreetmap.osmosis.xml.v0_6.impl.OsmHandler.endElement(OsmHandler.java:107) 
     at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) 
     at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) 
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) 
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) 
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) 
     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) 
     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) 
     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 
     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) 
     at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) 
     at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source) 
     at javax.xml.parsers.SAXParser.parse(Unknown Source) 
     at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:111) 
     at java.lang.Thread.run(Unknown Source) 
Caused by: org.postgresql.util.PSQLException: FEHLER: Relation ╗schema_info½ existiert nicht Position: 21 
     at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) 
     at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) 
     at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) 
     at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) 
     at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374) 
     at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254) 
     at org.openstreetmap.osmosis.pgsimple.common.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:71) 
     ... 19 more 
30.10.2012 23:06:56 org.openstreetmap.osmosis.core.Osmosis main 
SCHWERWIEGEND: Execution aborted. 
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed 
. 
     at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146) 
     at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92) 
     at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
     at java.lang.reflect.Method.invoke(Unknown Source) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
     at org.codehaus.classworlds.Launcher.main(Launcher.java:47) 

我該如何解決這個問題?

+0

在堆棧跟蹤中有一條消息'表schema_info不存在'。我正在尋找如何修復它...... –

回答

4

您需要按here所述初始化PostGIS簡單模式。

The schema creation scripts can be found in the scripts directory within the osmosis distribution.

These scripts are:

  • pgsimple_schema_0.6.sql - Builds the minimal schema.
  • pgsimple_schema_0.6_action.sql - Adds the optional "action" table which allows derivative tables to be kept up to date when diffs are applied.
  • pgsimple_schema_0.6_bbox.sql - Adds the optional bbox column to the way table.
  • pgsimple_schema_0.6_linestring.sql - Adds the optional linestring column to the way table.
  • pgsimple_load_0.6.sql - A sample data load script suitable for loading the COPY files created by the --write-pgsimp-dump task.

如果您使用PgAdmin3打開這些文件並執行它們。或使用psql命令。當然,PostGIS應該安裝在你的數據庫中。

+0

我無法在PostgreSQL \ 9.2 \ share \ contrib \ postgis-2.0'目錄中找到這些文件。這是否意味着滲透因爲它期望另一個PostGIS版本而失敗? –

+0

'pgsimple_ *'文件位於'osmosis \ scripts'目錄中。據我所知,在PostGIS 2.0中,滲透工作正常。 –

+0

在PgAdmin3中加載'pgsimple_load_0.6.sql'時,出現錯誤'[ERROR] 18.0:語法錯誤,意外字符'。 –

0
osmosis.bat --read-xml file="map.osm" --write-pgsimp validateSchemaVersion=no user="ccp-web-user" database="ccp-web2" password="ccp-web-password" 
+2

爲您的代碼和格式添加解釋代碼作爲代碼 – Sandeep