3

I am attempting to load an OSM .bz2 file into a PostGIS database using osm2pgsql but am stuck at a duplicate key value in the nodes which violates a unique constraint - any suggestions? output is below:

C:\Temp>osm2pgsql -s -C 3000 -U postgres -W -d POSTGIS -S C:\temp\default.style us-west-latest.osm.bz2 osm2pgsql SVN version 0.69-21289M

Password: Using projection SRS 900913 (Spherical Mercator) Setting up table: planet_osm_point NOTICE: table "planet_osm_point" does not exist, skipping NOTICE: table "planet_osm_point_tmp" does not exist, skipping Setting up table: planet_osm_line NOTICE: table "planet_osm_line" does not exist, skipping NOTICE: table "planet_osm_line_tmp" does not exist, skipping Setting up table: planet_osm_polygon NOTICE: table "planet_osm_polygon" does not exist, skipping NOTICE: table "planet_osm_polygon_tmp" does not exist, skipping Setting up table: planet_osm_roads NOTICE: table "planet_osm_roads" does not exist, skipping NOTICE: table "planet_osm_roads_tmp" does not exist, skipping Mid: pgsql, scale=100, cache=3000MB, maxblocks=384001*8192 Setting up table: planet_osm_nodes * WARNING: intarray contrib module not installed * The resulting database will not be usable for applying diffs. NOTICE: table "planet_osm_nodes" does not exist, skipping Setting up table: planet_osm_ways NOTICE: table "planet_osm_ways" does not exist, skipping Setting up table: planet_osm_rels NOTICE: table "planet_osm_rels" does not exist, skipping

!! You are running this on 32bit system, so at most !! 3GB of RAM can be used. If you encounter unexpected !! exceptions during import, you should try running in slim !! mode using parameter -s.

Reading in file: us-west-latest.osm.bz2 Processing: Node(113650k) Way(0k) Relation(0k)COPY_END for COPY planet_osm_nodes FROM STDIN; failed: ERROR: duplicate key value violates unique constraint "planet_osm_node s_pkey" DETAIL: Key (id)=(2147483647) already exists. CONTEXT: COPY planet_osm_nodes, line 98676608

Error occurred, cleaning up

Thanks!

1 Answer 1

2

You are using osm2pgsql version 0.69 which does not support 64-bit identifiers and will accordingly not handle OSM files more recent than February 2013.

Although unrelated to the error you're getting you should make sure you are using a 64-bit system to make use of all your RAM and use a .osm.pbf extract, not a .osm.bz2 one.

1
  • Thanks Paul - I had used the HOTOSM package and apparently it switched to an older osm2pgsql executable, I copied/replaced the latest one (64-bit) into the HOTOSM \bin folder and it works great.
    – Michael
    Commented Jun 2, 2014 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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