[OSM-dev] Patch for osm2pgsql "duplicate keys"

Andrew M. Bishop amb at gedanken.demon.co.uk
Sun Dec 11 09:51:13 GMT 2011

There are two patches that allow duplicate data to be added using
osm2pgsql as shown by these two messages:


The first of these is now included in SVN (and in fact has been for a
long time) but the second one is not.  In the second message there is
the suggestion that this should be made a command line option but it
has never been implemented as such.

To scratch my own itch I have created a patch that adds a command line
option that can enable these two patches or default to them not

My own personal need is to import great_britain.osm and then add
ireland.osm both using data from geofabrik.  Either file can be
imported on its own and the only duplicate data comes from the tiny
overlap of the two data sets.  With this patch I can run osm2pgsql
twice, the first of which is fast because there is no duplicate data
to worry about and the second of which is fast because although there
is duplicate data there are not as many objects in the second file.
With this command line option it is faster to import now than it was
with both patches applied.

osm2pgsql --create              [...] great_britain.osm
osm2pgsql --append --allow-dups [...] ireland.osm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: osm2pgsql.diff
Type: text/x-diff
Size: 6025 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20111211/ec6cb6ae/attachment.diff>
-------------- next part --------------

Note: This patch was created against osm2pgsql-intarray since I use
      Postgres 8.3 which isn't supported by the newer osm2pgsql but I
      would imagine that it should apply against both.

Andrew M. Bishop                             amb at gedanken.demon.co.uk

More information about the dev mailing list