1

In order to create a local OSM server and connecting JOSM to this, we've installed and configured Rails port openstreetmap/openstreetmap-website. The next step was to insert a sample OSM file into Rails' Postgresql databae, using osmosis via the following command:

osmosis --read-xml file="test.osm" --write-apidb host="localhost:5432" database="openstreetmap" user="osm" password="osm" populateCurrentTables=yes validateSchemaVersion=no

JOSM connects to local OSM server and download/upload data to local database. The problem is when we want to export Rails port database into OSM file to save updates and changes created by team members using the following line:

osmosis --read-apidb host="localhost:5432" database="openstreetmap" user="osm" password="osm" --write-xml file="from_pg.osm"

Executing the command throws the following error, how it should resolve?

org.openstreetmap.osmosis.core.OsmosisRuntimeException: Database version mismatch. The schema contains unexpected migrations [20170222134109, 20161011010929, 20150111192335, 20140115192822, 20191120140058, 20160822153055, 20140117185510, 20181020114000, 20180204153242, 20150110152606, 20190518115041, 20150818224516, 20190702193519, 20150222101847, 20190623093642, 20161002153425, 20131212124700, 20140519141742, 20140210003018, 20181031113522, 20190716173946, 20140507110937], may need to upgrade osmosis or specify validateSchemaVersion=no.
    at org.openstreetmap.osmosis.apidb.v0_6.impl.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:118)
    at org.openstreetmap.osmosis.apidb.v0_6.impl.SchemaVersionValidator.validateVersion(SchemaVersionValidator.java:53)
    at org.openstreetmap.osmosis.apidb.v0_6.ApidbReader.runImpl(ApidbReader.java:74)
    at org.openstreetmap.osmosis.apidb.v0_6.ApidbReader$1.doInTransactionWithoutResult(ApidbReader.java:102)
    at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.openstreetmap.osmosis.apidb.common.DatabaseContext2.executeWithinTransaction(DatabaseContext2.java:94)
    at org.openstreetmap.osmosis.apidb.v0_6.ApidbReader.run(ApidbReader.java:99)
    at java.lang.Thread.run(Thread.java:748)
1

The error message already includes the solution:

may need to upgrade osmosis or specify validateSchemaVersion=no

You need to add this paarameter+value as option next to the --read-apidb parameter when calling osmosis. See https://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage_0.44#--read-apidb_.28--rd.29

3
  • I've included it but seems it's for writing osm file to postgresql and gives me this error: Argument validateSchemaVersion for task 2-write-xml was not recognised. – Harry Wilson Aug 3 '20 at 9:59
  • Without the full comamnd line I can only guess what your command looks like. In any case you need to include validateSchemaVersion=no after --read-apidb. Position of those arguments matters for osmosis. See wiki.openstreetmap.org/wiki/Osmosis/… ... Added more details to the answer now. – mmd Aug 3 '20 at 10:17
  • that was awesome! – Harry Wilson Aug 3 '20 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.