[Imports] bulk-import.py

Nakor nakor.wp at gmail.com
Wed Jan 13 05:15:57 GMT 2010


> I assume your using the bulk_import.py from
> 
> http://svn.openstreetmap.org/applications/utils/import/bulk_upload_06/bulk_upload.py
> 

Yes I do

>> On the third run it failed because it reached the 50,000 limit which I
>> quite do not understand as there are only 14,780 changes in the file.
>>
>> Any help on why it failed and how to make it succeed would be
>> appreciated.
> 
> The script 'should' be able to deal with inputs over 50,000, it should
> also be sending them this data in smaller chunks of 1000.  If you know
> the changeset id of your changeset you should be able to see all but the
> last uploaded chunk in the edit history for your user to see where the
> 50,000 edits come from.
> 
> If you can't figure it out maybe you can post a link to your input file
> and I can take a closer look at it.

I figured out that the script actually re-uploaded existing nodes with a
new ID. I patched it with the patch below and was able to import my
changeset with roughly the correct number of modifications.

  Thanks,

N.

Index: bulk_upload.py
===================================================================
--- bulk_upload.py	(revision 19412)
+++ bulk_upload.py	(working copy)
@@ -157,13 +157,14 @@
             action = elem.attrib['action']
         else:
             action = 'create'
+
+        if (not (action == 'create')) or (int(elem.attrib['id'])<0):
+          try:
+              self.currentChangeset.addChange(action, elem)
+          except ChangesetClosed:
+              self.createChangeset()
+              self.currentChangeset.addChange(action, elem)

-        try:
-            self.currentChangeset.addChange(action, elem)
-        except ChangesetClosed:
-            self.createChangeset()
-            self.currentChangeset.addChange(action, elem)
-
 class IdMap:
     # Default IdMap class, using a Pickle backend, this can be extended
     # - if ids in other files need replacing, for example




More information about the Imports mailing list