Anyone ever successfully converted a KMZ/KML into a shapefile, feature class, or csv with ALL attribute fields present in a tabular format?

529
3
10-18-2019 12:10 PM
Highlighted
New Contributor II

I am running into a roadblock where I need to somehow export the data from a points KMZ/KML file into a tabular format where all fields in the dataset are accessible. So far, I have only had minor luck in using the KML to Layer tool to get a feature class with all the geometry appropriately visible, but the attribute table shows that all the original attribute data is shoved into one field called "PopupInfo" and formatted as XML. 

I have seen other threads where they mention that Data Interoperability may be the best solution to fully export all KMZ/KML fields into a tabular format with all original fields present, but I was wondering if anyone in the community has ever gone through this workflow.

I do not have access to the original file that the KMZ was created from (at least, not yet) so for now, I am stuck.

My end goal is to be able to get all the data into a table where I can then append additional data and create a new dataset from it.

Any help is greatly appreciated. 

Reply
0 Kudos
3 Replies
Highlighted
Esri Regular Contributor

Hi Daniel

The trouble with KML is what appears like a table in most viewers can be different things under the covers, like HTML or XML documents, and you have to handle them differently with Data Interoperability.  I have seen scripted approaches too.  If you are really lucky the elements will have a schema document alongside them, but in my experience only if written with Data Interoperability or FME.  It will be data dependent.  I can take a look if you can share a file.

Highlighted
New Contributor II

Thanks for the reply Bruce Harold‌. Unfortunately I cannot share the file as it contains sensitive information. When you say "the elements will have a schema document alongside them," what would that look like? The only reference to schema when looking at the file in Notepad is in the first few elements within a "Document id" tag. I don't assume that is it?

Either way, it sounds like Data Interop is a long-shot solution? 

Do you think the best way to get this done is with a third party tool or a script? 

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Hi, a schema element is in the attached KML file, its the only way to preserve what data type each attribute is.

Data Interoperability will be able to extract your data (even if resorting to default text data types) but you do have to learn to drive it.

if you can script a little then going via OGR is an option:

KML - Keyhole Markup Language — GDAL documentation 

LIBKML Driver (.kml .kmz) — GDAL documentation 

Example calling OGR:

https://community.esri.com/community/open-platform-standards-and-interoperability/blog/2019/09/26/us... 

Unfortunately we don't ship the KML drivers in the core Pro python distribution but if you install GDAL from a conda distribution you'll add it, or outside of scripting download GDAL and use ogr2ogr command line.

Reply
0 Kudos