How do I use/edit a KMZ in Arcmap?

4139
6
04-12-2016 08:39 AM
DavidStafford
New Contributor II

I have kmz's that I would like to overlay in Arcmap for comparison to our data but I don't want to convert it.

0 Kudos
6 Replies
DarrenWiens2
MVP Honored Contributor

There is no way to view KMZ in ArcMap without converting it.

ChrisSmith7
Frequent Contributor

I think you can natively with ArcGIS Data Interoperability (ArcGIS Data Interoperability | Overview).

0 Kudos
DarrenWiens2
MVP Honored Contributor

You might be right, Chris. The supported formats lists "OpenGIS KML Encoding Standard" although I don't know if that includes all KML, or any KMZ.

0 Kudos
AdrianWelsh
MVP Notable Contributor

David,

Like Darren said, you will need to convert it.

Use this tool:

KML To Layer—Help | ArcGIS for Desktop

Make edits, then use the opposite tool to change it back:

Layer To KML—Help | ArcGIS for Desktop 

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

kmz files are zipped kml files ... some backgrounders that are useful

Can I convert a kmz file to kml? - Geographic Information Systems Stack Exchange

provides some help and with the aid of python  modules:

  • glob xml.dom and zipfile modules

one can even process things directly, for example

Calculate distance from .kmz files « Python recipes « ActiveState Code

And there are many other examples out there.

DanPatterson_Retired
MVP Esteemed Contributor

well...

"""
Script:     kmz_kml.py
Author:    
Dan.Patterson@carleton.ca

References: many
Purpose: convert kmz to kml base script
"""

import zipfile
from xml.dom import minidom

def kmz_to_kml(fname):
    """save kmz to kml"""
    zf = zipfile.ZipFile(fname,'r')
    for fn in zf.namelist():
        if fn.endswith('.kml'):
            content = zf.read(fn)
            xmldoc = minidom.parseString(content)
            out_name = (fname.replace(".kmz",".kml")).replace("\\","/")
            out = open(out_name,'w')
            out.writelines(xmldoc.toxml())
            out.close()
        else:
            print("no kml file")
if __name__ == "__main__":
    fname = r"Your_folder_here\GIS_central.kmz"
    kmz_to_kml(fname)

found it.  which could obviously be cleverly modified for batch production