With the proliferation of KML files created for use in Google Maps, Google Earth, or Google Fusion Table, you may find yourself needing to bring the data from a KML file into ArcGIS.
What is a KML file?
KML files are an XML-based geographic dataset and have an extension of .kml.
A KML file is a GIS file format used for displaying geographic data in applications such as Google Earth, Google Maps, and other mapping software. KML stands for Keyhole Markup Language, which is an XML-based language used for describing geographic data.
KML files can contain a wide range of geographic data, including placemarks, lines, polygons, 3D models, and images. The data in a KML file is organized using tags, which specify the type of data and its properties.
How is a KMZ file different from a KML file?
A KMZ file is a file format used for displaying geographic data in Google Earth and Google Maps. It is a compressed version of a KML file.
A KMZ file can contain a variety of geographic data, such as placemarks, images, 3D models, and polygons. The compressed format of the KMZ file allows for faster data transfer and smaller file sizes, which makes it more practical for sharing and distributing geographic data.
How to import a KML file into ArcGIS
ArcGIS can’t natively read KML files, so in order to access the geographic data, you will first need to first convert the KML file into a personal geodatabase (.gdb) using a tool provided within ArcGIS called KML2Layer.
The only way to actually view a KML file natively in ArcGIS without having to convert it is to purchase the ArcGIS Data Interoperability extension, which enables ArcGIS the ability to directly view more than 100 different GIS file formats.
Some notes to consider before starting this GIS tutorial:
KMLs and KMZs (up to version 2.2) can be converted using the KML2Layer tool.
Before you start the conversion process, make sure that the KML file has valid geographic data or you will be frustrated by the failure of your KML to convert to a geodatabase.
If your conversion process fails after following the steps in this GIS tutorial, check to make sure that the KML file contains valid geographic data. To help you, the Official Google Maps blog has information about KML validators.
The steps and screenshots in this tutorial were done using ArcGIS 10.0.
Open up ArcCatalog.
Click on the ArcToolBox icon (1) to open up the tools section.
Then click on the Conversion toolbox (2) to open up the data conversion options. Select the “From KML” toolkit to access the ‘KML to Layer’ tool.
Using the KML to Layer tool in ArcGIS
In the “KML to Layer” dialogue box, select the folder icon next to the Input KML File box.
Navigate to the location on your hard drive where the KML is stored. In the Output Location select the folder where you want the personal geodatabase (.gdb) to be stored.
In the Output Data Name either type in the name that you want the geodatabase to have or accept the default (which retains the name of the KML file.
A scrolling text indicated located in the lower right hand corner of ArcCatalog (1) will indicate the conversion is in process. Depending on the size of the KML file, this conversion process can take seconds or several minutes.
Once the KML to ArcGIS layer has completed, a small window (2) in the lower right hand corner of your desktop will pop up with a green check mark announcing the completion of the conversion.
If the conversion fails, the window will have a red check mark.
View your converted KML file in ArcGIS
Now you’re ready to view the converted file.
In the catalog tree section (1) of ArcCatalog, navigate to the folder you designated in the KML to Layer dialogue window as the output location. Find the .gdb file containing the same name you selected as the Output Data Name.
Click on the geodatabase to open it and drill down to the file you converted. The geographic dataset will be housed within “Placemarks” and will have an appendage of _point, _line or_polygon depending on the type of vector data converted.
A preview of the file can be viewed in the preview section (2).
You can toggle back and forth between the geographic data and the attribute table (3).
The converted file can now be loaded into an ArcMap session.
The output geodatabase file will be in the WGS84 coordinate system. If needed, the resulting geodatabase can be be reprojected after the conversion process.
As noted in the beginning of this tutorial, if the KML file doesn’t contain valid geographic features, the conversion will fail.