My users are sending me point data that were digitized using Google Earth.

How can I convert their KML to a shapefile and vice versa?

  • Although this is the inverse operation, the majority of the answers to the question @iant linked to work both ways.
    – JasonBirch
    Aug 26 '10 at 20:17
  • In this case, I agree with the closure. Let's take the discussion to meta.
    – glennon
    Aug 29 '10 at 18:46
  • "Layer to KML" in ArcMap will do exactly what you are looking for. Jun 30 '17 at 21:25

26 Answers 26


Using the open source ogr2ogr from GDAL/OGR:

ogr2ogr -f 'ESRI Shapefile' output.shp input.kml

or for the reverse:

ogr2ogr -f KML output.kml input.shp 

As noted in grego's comment below, you may need to use double quotes instead of single quotes for the output format option (e.g. "ESRI Shapefile" for the Windows command line). See also the gdal wiki.

  • A couple of syntax points worth noting when using ogr2ogr (save yourselves hours of frustration): 1. For any of the option "tags" in your ogr2ogr string, make sure there's no spaces between the - and the word i.e. -progress NOT - progress)
    – grego
    Jul 23 '19 at 22:08
  • 2. Typing ogr2ogr -help (hit enter) shows you all the possible options. It's important to use these option "tags" in the correct sequence i.e. -progress -f NOT -f -progress) (Here's what ogr2ogr -help prints out): Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update] [-select field_list] [-where restricted_where|@filename] [-progress] [-sql <sql statement>|@filename] [-dialect dialect] [-preserve_fid] [-fid FID] etc. etc.
    – grego
    Jul 23 '19 at 22:09
  • 3. The format is the only part of the string that should have quotes around it. (Either single quotes or double quotes, depending what environment you're running ogr2ogr in: for me, in the QGIS > OSGeo4W shell, I use double quotes i.e. "KML" not 'KML' 4. You can get the full format list (90 different formats) by typing in: ogr2ogr --formats
    – grego
    Jul 23 '19 at 22:09

ArcGIS 10 has a GP tool called KML To Layer that converts KML to a feature class. Search for KML using the new search. I've used this to take the oil spill kml feeds from Google and convert them into SHP.

KML To Layer can only create a geodatabase feature class so that needs to be followed by a Feature Class To Feature Class step to convert it to a shapefile.


Use ogr2ogr, but if you're not interested in a command line, try ogr2gui - a really simple front end for ogr2ogr.

ogr2ogr -f KML output.kml input.shp 

To use spatial data published as a KML or KMZ file in ArcGIS you must first convert the KML to a feature class (shapefile). The University of Connecticut has a published a script for creating shapefiles from KML called KML_to_Shp.tbx. It works quite well and you can use it from ArcToolbox. Because KML will (should) always be in geographic coordinates (WGS84), you will eventually want to transform them to UTM Zone 15N NAD83...

As with all new tools, review the documentation on prior to use. This can be found on the UCONN’s Center for Land Use Education and Research web site. Once you add it to your toolbox and understand its limitations, the tool is very straight forward to use.


  • 3
    You don't always want UTM Zone 15N NAD83, you want the proper zone for the data. And you can also project using WGS84 (ie, WGS84 doesn't mean latlon)
    – Vinko Vrsalovic
    Jul 23 '10 at 0:20

If you are interested in command line tools, you can use GDAL/OGR from OSGEO.



One more commercial product that bears mentioning is Global Mapper. This falls in the category of view, convert, re-project almost any geographic data you can imagine. I use the free version heavily in a class I teach and almost everyone walks away commenting on how this is the swiss army knife of GIS tools (though the free version doesn't do translations, it exposes all the menu's and options). Well worth the cost in my experience.


Couple more options in addition to the other answers...

SL-King's fdo2fdo application, which uses the open source FDO libraries, allows you to perform KML to SHP and visa versa translations. It includes both a GUI (which express format-to-format translations and more customized schema mapping translations) as well as a commandline tool.

For properietary applications, Safe Software's FME gives you amazing control over how you map the source information into destination. If you have ArcGIS, you can access this via the Data Interoperability Extension (list of formats) at additional cost.

If they are just point features with no attributes, I'd consider parsing the XML into something you can easily import like a CSV; you're just looking for the data between the coordinates tags.


Another option is to use XToolsPro, a third-party extension that works in ArcGIS. Amongst their many handy conversion tools is a "Import Data from KML" function.


QGIS has become much more robust for the conversion between kml and shp. Just use the Save As from the right click menu on the layer. Or open up each of those file types from the Add New Layer menu, be sure to change the file type in the dialog box.


FME posted a beta for an online tool that handles many different types of conversion, including this. http://fmeserver.com/userweb/sharper/Portal/EasyTranslator/index.html This converter should really help you.


There are also some other commercial products. Arc2Earth comes to mind. It's got pretty good integration with ArcGIS Desktop. http://www.arc2earth.com

  • 1
    Arc2Earth is closed for business, as of August 2018.
    – Mike T
    Sep 20 '20 at 23:59

If you'd like a GUI, you can use QGIS. It uses OGR/GDAL in the background.


You can also look at FME from Safe Software http://www.safe.com

There is a 14 day trial available. FME lets you even map the attributes from your KML file to ESRI SHP format during the data conversion/migration process besides the ability to filter the KML point files based on certain attributes or spatial extents.

There is also the option to do batch conversion when you have a large set of KML files from your users.


use OGR for command line control, Google Earth Pro will give you a graphical way to convert, as will a variety of other apps


ET GeoWizards also has an import from Google Earth option, which will convert KML or KMZ files to feature class. > http://www.ian-ko.com/ET_GeoWizards/gw_MainFeatures.htm

If you're looking for an open source option, I see MapWindow was just updated, and there are a couple of plugins for converting to and from KML and shapefile.


The Open Source MapWindow GIS has a free extension (KML2Shapefile) for converting KML/KMZ files into shapefiles.


If you have the interop extension just load that KML straight into ArcMap and export to shp.

Although the opposite answer to your Q, in case someone has come here to do the vice versa, I find this script perfect to go from SHP-->KML http://arcscripts.esri.com/details.asp?dbid=14273


If you would like to convert your files online, try MyGeodata GIS formats and coordinate system converter. It is based on ogr2ogr (gdal/ogr library) - so almost all known GIS formats and coordinate systems are supported...


A few options I didn't see on any of the responses to add additional resources for converting KML to SHP would be the follow:

MyGeodata Converter

Online converter of Keyhole Markup Language format to ESRI Shapefile format (KML to SHP) is fast and easy to use tool for both individual and batch conversions. Converter also supports more than 90 others vector and rasters GIS/CAD formats and more than 3 000 coordinate reference systems.

Free Geography Tools covers and provides a tutorial of Zonums Software tool


Zonum Solutions' Online KML to Shapefile converter also works well:



A good and easy help that might produce a more clean results is to convert KML to GPX first (there are several open-source software that can do it) and open the respective data (GPX has 5 different class of information: Waypoints, Trackpoints, Routepoints, Tracks and Routes) using the ogr2ogr from GDAL/OGR in QGIS and save it directly in .SHP file format.

It's quite easy also to use batch process for large quantity of data (using the Merge Vector Layers from SAGA for example) to produce a single shape file if desired and you can also clear the empty attributes before the final "Save as SHP".

Take special attention to the codification system if strange characters appear on your final result... you can choose the proper one at the moment you are adding new vector data to your map.


I am late to the party but here are a few extra ways:

  1. Google Fusion Tables, it can convert KML points information to WGS84 X and Y in a .csv format, which you can then use in your preferred GIS analysis software.

  2. Using the rgdal package in R.:

    library(rgdal) #load package
    kmlfile=readOGR("yourkmlfilehere.kml") #load KML
    writeOGR(kmlfile,"yourshapepath",layer="shapename", driver="ESRI Shapefile") #save shape

Another tip: If you want to convert multiple KMLs in a folder/directory at once to shapefile using the command line, open up cmd in the folder and type this in:

for /R %f in (*.kml) do ogr2ogr -f "ESRI Shapefile" "%~dpnf.shp" "%f"

Note: It will use the name of the KML as the name of the shapefile so make sure your KMLs have the proper naming formats for shapefiles. The shapefile will be created in the same directory as the corresponding kml. KMLs in sub-directories will be converted to shapefiles too.


I struggled a lot to get gdal/ogr working on my system, if you too are experiencing something similar, here is a way around using libraries that are easily installed using pip/conda across all OS.

import geopandas as gpd
from bs4 import BeautifulSoup
from shapely.geometry.polygon import Polygon

doc = open('file.kml').read()
soup = BeautifulSoup(doc, features="lxml")
for i in soup.findAll('coordinates'):
xyz = coord[0][0].strip().split(' ')
for i in xyz:

poly = Polygon(finalres)
gdf = gpd.GeoDataFrame(index=[0], crs='epsg:4326', geometry=[poly])

For converting KML to Shp file format you can use ogr2ogr utility. Firstly you need to install it in the system, If you already installed it use type ogr2ogr in the terminal.

Now for conversion the given command needs to be executed i.e.

--- ogr2ogr -f 'ESRI Shapefile' Output_sahpefile.shp Input_KML.kml

This is how conversions can be done by ogr2ogr and if you are not getting results you can convert Kml to shp by coding method.

this can also be done using PHP. You can create a function that defined this command as string and can give this string in shell_exec() method to execute. Shell_exec() actually execute the command and returns output as string.

public function KML_to_shp($KMLfilepath,$output){
 $query="ogr2ogr -f 'ESRI Shapefile'  $output.gml  $KMLfilepath";

here is an post to convert kml to shp using command line tool ogr2ogr or using php code. While if you use QGIS tool, you can look over one of my blog post here kml to shp convert using QGIS or else continue using this post.

  • 1
    are you associated with the website you are offering as an answer? If so please state it in your posts.
    – LaughU
    Apr 24 '18 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.