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

Brett Henderson brett at bretth.com
Thu Mar 3 09:18:27 GMT 2011

This is a known limitation of Osmosis bounding box processing.

When you perform a bounding box extract, if nodes lie outside the bounding
box, but are referenced by ways inside the bounding box they will not be
included in the file.  This is due to the way Osmosis processing works
because it finishes processing nodes before it sees the ways.

You have several options here:
1. Drop the constraint from the database.  This might lead to other issues.
2. Add the clipIncompleteEntities=true option to the --bounding-box task.
This will modify the ways so that they no longer reference the problematic
ways.  Obviously they will no longer be identical to the original ways from
the input planet file.
3. Add the completeWays=true option to the --bounding-box task.  This will
include the missing nodes, but will slow down processing enormously.

On Thu, Feb 17, 2011 at 12:07 AM, Egoitz Ormaetxea <
egoitz.ormaetxea at gmail.com> wrote:

> - 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 ?
> _______________________________________________
> osmosis-dev mailing list
> osmosis-dev at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/osmosis-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20110303/df7ef06d/attachment.html>

More information about the osmosis-dev mailing list