[OSM-dev] osm2pgsql: Importing several Geofabrik OSM files

Jan-Benedict Glaw jbglaw at lug-owl.de
Thu Jul 30 14:47:06 BST 2009


Hi!

I just tried importing germany.osm.bz2 and denmark.osm.bz2 from
http://download.geofabrik.de/osm/ .  However, importing the second
file after the first one failed due to duplicate ways. Just hacked
osm2pgsql to use ACTION_MODIFY instead of ACTION_CREATE, which seems
to simply work. (In the attached patch, probably only the first chunk
is actually needed.)

The patch is attached, but it's not yet ready to include it. I guess
simply MODIFYing the data instead of CREATEing it will waste a good
chunk of performance, so that should depend on --append. But the args
seem to be not given down to all funktion calls. Jon, it would be nice
if you'd decide on whether to make this work at all, and how.

Index: osm2pgsql.c
===================================================================
--- osm2pgsql.c	(revision 16736)
+++ osm2pgsql.c	(working copy)
@@ -136,7 +136,7 @@
     actions_t new_action = ACTION_NONE;
     xmlChar *action = xmlTextReaderGetAttribute( reader, BAD_CAST "action" );
     if( action == NULL )
-        new_action = ACTION_CREATE;
+        new_action = ACTION_MODIFY;
     else if( strcmp((char *)action, "modify") == 0 )
         new_action = ACTION_MODIFY;
     else if( strcmp((char *)action, "delete") == 0 )
@@ -159,7 +159,7 @@
         if (xmlStrEqual(name, BAD_CAST "osm"))
         {
             filetype = FILETYPE_OSM;
-            action = ACTION_CREATE;
+            action = ACTION_MODIFY;
         }
         else if (xmlStrEqual(name, BAD_CAST "osmChange"))
         {


MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw at lug-owl.de              +49-172-7608481
Signature of:          GDB has a 'break' feature; why doesn't it have 'fix' too?
the second  :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20090730/ad6fe9df/attachment.pgp>


More information about the dev mailing list