Select to view content in your preferred language

Import KMZ folder using script

176
3
a month ago
Brucemartin
Emerging Contributor

Good afternoon,

Apparently ESRI does not have the time for me and redirected me to ask this question on this board. 

Does anyone know of a script for importing KMZ folders?

Thank you

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

Batch Import Data (AllSource)—ArcGIS Pro | Documentation

it will import kmz files within a folder, but if you have multiple folders to parse, it may have to be scripted


... sort of retired...
0 Kudos
Brucemartin
Emerging Contributor

Good day, used this:

import arcpy
arcpy.intelligence.BatchImportData("O:\Active Projects\New Braunfels\01_Project KMZ Files\2013", "H:\GIS PROJECTS\PROPOSALS\Enviromental 2023 Tom\Enviromental 2023 Locations\Enviromental 2023 Locations.gdb", "kml", "SUBFOLDERS", "NO_GROUNDOVERLAY")

 

am getting this:

 Traceback (most recent call last)
File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ast.py, in parse:
Line 50:    return compile(source, filename, mode, flags,

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 18-19: malformed \N character escape (<string>, line 2)
0 Kudos
DanPatterson
MVP Esteemed Contributor

a python basic... use raw encoding to format strings ( r"...." )

# -- needs encoding
a = "O:\Active Projects\New Braunfels\01_Project KMZ Files\2013"
  Cell In[4], line 1
    a = "O:\Active Projects\New Braunfels\01_Project KMZ Files\2013"
                                                                    ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 18-19: malformed \N character escape

a = r"O:\Active Projects\New Braunfels\01_Project KMZ Files\2013"

b = r"H:\GIS PROJECTS\PROPOSALS\Enviromental 2023 Tom\Enviromental 2023 Locations\Enviromental 2023 Locations.gdb"
Locations\Enviromental 2023 Locations.gdb"
a
'O:\\Active Projects\\New Braunfels\\01_Project KMZ Files\\2013'
b
'H:\\GIS PROJECTS\\PROPOSALS\\Enviromental 2023 Tom\\Enviromental 2023 Locations\\Enviromental 2023 Locations.gdb'

... sort of retired...
0 Kudos