Select to view content in your preferred language

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

5124
4
10-18-2019 12:10 PM
DanielCota
Emerging Contributor

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. 

0 Kudos
4 Replies
BruceHarold
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.

DanielCota
Emerging Contributor

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? 

0 Kudos
BruceHarold
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.

0 Kudos
py4wildlife
Occasional Contributor

This issue seems to have been on GeoNet for years, that is Convert KML -> Shapefile or layer with the HTML popup info translated into field attribute columns. Global Mapper solves this problem seamlessly with the click of 2 buttons with accurate results for a layer I tried with their trial version. The output was enough to make use of the total KMZ dataset without worrying about the different components of KMLs containing tabular info (pics provided).  I have looked everywhere. I am not sure why there is not a straightforward way to do this as of yet with Esri. I am hoping it will be added for general use and workable outputs to Pro. It appears this idea implementation was in progress in 2015.  I do not work for BlueMarbleGeo, but it has been the only solution I have found if you need one.

https://www.bluemarblegeo.com/products/global-mapper.php

Z. Smith, Ph.D.
GIS Analyst