Convert KML to Shapefile in ArcMap or by using Python

KML to shapefile in arcMap
There are multiple ways to convert a KML file into a shapefile. Almost all GIS software allow the conversion from one vector format to another quite conveniently.

Converting KML to shapefile format can also be done by other free geospatial softwares such as QGIS/ENVI, etc. The problem you might face is that the file will lose some of its attribute information. The geolocation however will remain the same.

The most common way among GIS analysts to convert shapefile to KML file in ArcMap is shown in the embedded video below.

Generating KML/KMZ format from Google Earth Pro
KML (Keyhole markup language) file is normally the export file from Google Earth Pro as also shown in the video. It can be in the form of points (Tree locations, poles, etc), polygons (certain area or boundary), or lines(roads, ditches, etc). For the sake of simplicity, I used a point to explain the output.

Conversion tools
ArcGIS Desktop conversion tools is used to convert files from one format to another format, be it Raster or Vector. There are multiple tools available in this toolbox that will help you convert datasets(including, CSV, JSON, etc.).

From where will you get a KML file?
KML is commonly the output in vectors from Google Earth software. Vectors are generally Points, Polygons, or lines.

ArcMap Desktop method:
First of all, go to Arc Toolbox. In conversion tools, go to “from KML”>> KML to Layer.


KML to layer - arcgis desktop tools
Arcmap Desktop, Arctoolbox tool screenshot

This tool can be used for the conversion of KML file format to a layer file. Soon the video version of it will also be released for this process.

Don’t have an ArcMap license? Don’t worry you can also do geospatial analysis for free in an open-source GIS software QGIS.

Want me to do Geospatial analysis for you?

Shapefile to KML
Similarly for Shapefile to convert to KML, in conversion tools, “To KML” should be used for the process.

QGIS method:
QGIS is open-source free-to-install software. It’s used for GIS analysis.

If you have any questions or any queries about this process, please do let me know.

Follow Climate learners on Facebook

KML to shapefile using Python Code

For programmers there is a method for automation.This can convert the KML/KMZ file to shapefile(ESRI format for feature classes). The following code can be used for this purpose:

Convert KML to Shapefile using Geopandas & Fiona)

import pandas

import geopandas as gpd, fiona

driverf = 'KML'
fiona.supported_drivers[driverf] = "r"




# Read the KML file into a GeoDataFrame 

# replace the path with the path of file in your PC
kml_file = r"path"
gdf = gpd.read_file(kml_file, driver=driverf)


driver2 = 'ESRI Shapefile'

# Write the GeoDataFrame to a shapefile
shp_file = r"path"
gdf.to_file(shp_file, driver=driver2)

print(f'file converted to {driver2} from {driverf} - Climate Learners')

Python language can be used to automate the repetitive tasks in your daily work. Many GIS analysts are afraid of learning the programming languages which directly impacts their work efficiency. Suppose you have 1 thousand or even 1 million KMZ/KMZ files which you need to convert to some other format. What will you do? please write your answer in the comments.

If you want to learn Python language from a GIS analyst. Contact me for one on one session.

keywords: Shapefile to kml

Scroll to Top