1

I've got a very simple code using an ArcPy tool to convert KMLs to Layers in a directory:

import arcpy, os
from arcpy import env

arcpy.env.workspace = r"C:\KML\Test"
outLocation = r"C:\KML\Test\Convert"

for kml in arcpy.ListFiles('*.KML'):
    print "Converting {0}".format(os.path.join(arcpy.env.workspace, kml))
    arcpy.KMLToLayer_conversion(kml, outLocation)

Each KML is no less than 20,000 KB and probably has 2000-3000 records per. On average, it is taking about 1.4 - 2 minutes for each KML to convert using the arcpy.KMLToLayer_conversion().

Any thoughts on if this is a memory issue? Not sure why it appears to be running so slow.

Also of note, import arcpy causes the script to delay for about 5 seconds when it starts.

This code is run outside of ArcMap through IDLE.

closed as off-topic by Vince, whyzar, Mapperz Mar 3 '17 at 15:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, whyzar, Mapperz
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format. How many KML files are you converting? How long does it take to convert just one, e.g. arcpy.KMLToLayer_conversion(r"c:\temp\mykml.kml", r"c:\output") – Midavalo Mar 2 '17 at 20:40
  • 6
    ArcPy is a very large library so I think that 5 second delay is to be expected when it is first imported. Where are you running your code? – PolyGeo Mar 2 '17 at 20:44
  • 1
    @pstatix You mentioned you thought it was a memory issue. Often this is evidenced in the tools slowing down the more files it processes, so I asked how long it takes to run once just using a single command (outside of your script). If it is consistent, then it may just be the speed of the tool rather than any speed issue. – Midavalo Mar 2 '17 at 21:02
  • 1
    If it is consistent for each issuance of that geoprocessing tool then it suggests that you need to look at the performance of that tool with your data rather than at ArcPy. – PolyGeo Mar 2 '17 at 21:14
  • 2
    This has nothing to do with ArcPy performance or memory -- caching a massive XML document simply takes a significant effort. – Vince Mar 2 '17 at 23:29
2

I consider a 20,000 KB kml to be quite large and would expect to see the processing times you are experiencing.

Most kmls I use are less than 1,000 KB and take ~10-20sec to convert.

Using that benchmark, if I process a 20,000 KB kml, the time will be 10 * 20 = 200 seconds = 3min.

At 1.4-2 min, your machine is processing kmls faster than mine.

  • Valid point. Occasionally we have 365 KMLs per one data query. A processing time of 1.4-2 minutes gives us a total script runtime of 8.5 hours (511 minutes) to 12.2 hours (730 minutes). Was hoping to reduce this drastically but our machines are what they are (GFE!). Thank you. – pstatix Mar 3 '17 at 12:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.