I've managed to setup both locally tile_server and API on rails-port. Their dbs are populated with local copy of maps. Im able to preview tiles and download rawdata from API using JOSM. When im uploading changes back to API server i cannot see the changes on tiles, which is ok because they have seperate databases. I assume replication is needed. I've gone through http://wiki.openstreetmap.org/wiki/Osmosis/Replication and http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage_0.43 Right now im a bit stuck because, when i tried to use osmosis --replicate-apidb I ended up with new folder called replicate which has state.txt replicate.lock files and 000 folder and inside this folder i have 001.state.txt and 001.osc.gz but it appears that there is no data, like if there were no changes at all. i've also tried osmosis -q --replicate-apidb iterations=0 minInterval=10000 maxInterval=60000 authFile=dbAuth.txt --send-replication-sequence port=8081 --write-replication workingDirectory=data but here i end up with error message: Task type write-replication doesn't exist. It seems that im missing some steps but i have no clue where to look. Right now i want just to update my tile_server db with my recent change, but when this works i would like to set osmosis to do it automatically every hour or minute, so that i dont bother anymore with console. asked 01 Jun '16, 15:44 jorax |
Today i tried to make one-off data migration.
osmosis --read-apidb-change authFile=Auth.txt validateSchemaVersion=no intervalBegin="2016-05-29_00:00:00" --write-xml-change
THis produced change.osc with the data i want so big success
Now something is wrong with db:
osmosis --read-xml-change --write-pgsql-change authfile=Auth.txt validateSchemaVersion=no
this results in error:
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT id, name FROM users WHERE id = ?]; nested exception is org.postgresql.util.PSQLException: ERROR: relation "users" does not exist
So i tried osm2pgsql
osm2pgsql -l --append --database gis --username root --slim --cache 2048 change.osc
This ends up with another error:
Osm2pgsql failed due to ERROR: result COPY_END for planet_osm_polygon failed: ERROR: Geometry SRID (4326) does not match column SRID (900913) CONTEXT: COPY planet_osm_polygon, line 1, column way: "SRID=4326;POLYGON ((9.6640657999999995 53.5647483999999992, 9.6643272000000007 53.5649425000000008, ..."
Ok above comment is almost ok, problem was with flag -l. After removing this flag, i managed to import change.osc file. But still this is a manual process. My goal is to have this automatically.
Do you success to set the osmosis replication task automatically? Can you tell me how to make it automatically?