[osmosis-dev] Unable to load current way nodes, when extracting and importing data from a osm file to a API BD

Egoitz Ormaetxea egoitz.ormaetxea at gmail.com
Wed Feb 16 13:07:26 GMT 2011


- Downloaded planet file planet-110202.osm.bz2
- Extracted a osm for the zone 43.5N -3.5W | 42N -1W with osmosis :
bzcat planet-101027.osm.bz2 | osmosis --read-xml file=/dev/stdin
enableDateParsing=no --bounding-box top=43.5 left=-3.5 bottom=42 right=-1
--write-xml file=- | bzip2 > extracted.osm.bz2
It takes 2 hours to complete but it finishes with no errors.

- Clear the API DB :
dropdb openstreetmap
createdb -E UTF8 -O openstreetmap openstreetmap
dropdb osm_test
createdb -E UTF8 -O openstreetmap osm_test
dropdb osm
createdb -E UTF8 -O openstreetmap osm
psql -d openstreetmap < /usr/share/postgresql/8.4/contrib/btreet_gist.sql
rake db:migrate
rake test

- Import extracted osm file to the API DB with osmosis :
bzcat extracted.osm.bz2 | osmosis --read-xml-0.6 file=- --write-apidb-0.6
populateCurrentTables=yes host="localhost" database="openstreetmap"
user="openstreetmap" password="xxx" validateSchemaVersion=no

Ends with error :

org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to load
current way nodes.
...
Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on
table "current_way_nodes" violates foreign key constraint
"current_way_nodes_node_id_fkey"
Detail: Key (node_id)=(490767853) is not present in table "current_nodes"
...

The 'weird' thing is that 490767853 node is out of the bounding box
http://www.openstreetmap.org/browse/node/490767853 : 42.3951781,
-3.5017794<http://www.openstreetmap.org/?lat=42.3951781&lon=-3.5017794&zoom=18>

Am I doing the process to extract+import correctly ? Is there a way to avoid
this error ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20110216/2a1bfa99/attachment.html>


More information about the osmosis-dev mailing list