Now i want to add USA map, i have downloaded ¨south-america-latest.osm.pbf¨ and executed command osm2pgsql --append --slim -C 24500 --number-processes 8 south-america-latest.osm.pbf BUT i get error:
COPY_END for COPY planet_osm_rels FROM STDIN;
failed: ERROR: duplicate key value violates unique constraint “planet_osm_rels_pkey”
DETAIL: Key (id)=(2668952) already exists.
CONTEXT: COPY planet_osm_rels, line 4301
Error occurred, cleaning up
So, if i have imported one map in osm.pbf i can´t just add (append) another map? Lets say, for continents it is very time-consuming process! I can´t just add like map by map to database? Because Europe + USA will take a couple of days again…
So, this mean, if i have imported like Europe map and want to add USA map, in fact, this is no easy and fast process, right? I cannot use just append command. I must somehow join USA and Europe map. In your case, i will have only USA or Europe map, but i need both maps in one
That is correct. You will first need to merge the two files and then import the merged file. osmconvert or osmium-tools should be able to do the merging.
The reason that ‘–append’ does not work is that --append is for updates to existing data, not for adding another region.
And if you want to import europe and the US, it is questionable whether it even makes sense to use an extract instead of just the whole planet. Because together, NA + Europe have about 75% of the data in OSMs planet file. So you hardly save anything compared to just using the whole planet (which would also make updates easier).