[Geoserver-users] Fail to append new OSM data to PostGIS using osm2pgsql

Hi,

I post my question here but not sure if this is the right group since I
could not find any group specific for osm2pgsql problem. I am trying the
append new osm dataset to my PostGis database and keep getting duplicate key
value violation error even though the osm data are from different part of
the country. For example:

First, I imported California, USA using the following command:
osm2pgsql -U postgres -m -s -K -d osm -p osm -E 3857 -S default.style
california-latest.osm.bz2

then imported Rhode Island using this command:
osm2pgsql -U postgres -m -s -K -a -d osm -p osm -E 3857 -S default.style
rhode-island-latest.osm.bz2

Here is the screen capture of the command output:
osm2pgsql SVN version 0.70.5

Using projection SRS 3857 (EPSG:3857)
Setting up table: osm_point
NOTICE: table "osm_point_tmp" does not exist, skipping
Setting up table: osm_line
NOTICE: table "osm_line_tmp" does not exist, skipping
Setting up table: osm_polygon
NOTICE: table "osm_polygon_tmp" does not exist, skipping
Setting up table: osm_roads
NOTICE: table "osm_roads_tmp" does not exist, skipping
Mid: pgsql, scale=100, cache=800MB, maxblocks=102401*8192
Setting up table: osm_nodes
*** WARNING: intarray contrib module not installed
*** The resulting database will not be usable for applying diffs.
Setting up table: osm_ways
Setting up table: osm_rels

Reading in file: rhode-island-latest.osm.bz2
Processing: Node(673k) Way(69k) Relation(300) parse time: 91s

Node stats: total(673452), max(2144239393)
Way stats: total(69015), max(258361546)
Relation stats: total(300), max(3403421)

Going over pending ways
processing way (0k)COPY_END for COPY osm_rels FROM STDIN;
failed: ERROR: duplicate key value violates unique constraint
"osm_rels_pkey"
DETAIL: Key (id)=(148838) already exists.
CONTEXT: COPY osm_rels, line 25: "148838 2 432
{158368533,424317935,42299022,42299024,42298793,240353468,240353467,42298798,42298795,2..."

In fact, I have tried the above steps with different dataset such as:
(Alabama, Rhode Island), (Alabama, New Hamshire), etc. and all of them
ended up with same errors.

Am I doing anything wrong here or osm2pgsql could not be used to append new
data to PostGis database?
Is there any work around or better way to do this? Also, will this problem
also occurs in differential update of the planet_osm database?

Many thanks in advance.

Regards,
Tam

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Fail-to-append-new-OSM-data-to-PostGIS-using-osm2pgsql-tp5102135.html
Sent from the GeoServer - User mailing list archive at Nabble.com.