blankblank blank




Another Way To Convert Google Earth KML Files To Shapefiles



Note: See this series of posts for info on converting shapefiles to KML format.

In the last post, I covered a mildly painful way to convert the vector data (points, paths, and polygons) in Google Earth KML files to shapefile format, while keeping at least the name associated with the points and paths. Today, I’ll describe a simpler and faster two-step process, but one that unfortunately doesn’t keep the name or any of the other KML data associated with the original shapes.

This process works with any KML file, with any combination of points, paths, and polygons; unlike the previous approach, there’s no real benefit to saving points, paths, and polygons in separate files. Here’s a screenshot of the KML data I’ll be using in this example:

sample KML file for conversion to shapefile

The first step is to convert the KML files into AutoCAD DXF format using KML2x website tool. This website actually converts KML files not just into DXF format, but also GPX, Surfer, and several text formats (CSV and tab-delimited text, although some editing would have to be done to make these textfiles importable into a spreadsheet). Here’s a screenshot of the website with a KML file loaded in:

KML2x interface to convert KML file to DXF Autocad file

The text that appears in the box below is the actual KML file content. You might have noticed that under File Format, SHP-ESRI is listed as an option. It’s currently not enabled, but hopefully at some point in the future it will be, and you’ll be able to do a direct conversion. But for now, you have to follow the DXF route, because there’s a way to convert DXF files to shapefiles.

With DXF selected as the file format for export, and the desired coordinate system (UTM or geographic) specified, you can select point, path, and/or polygon as the desired data types to export. For subsequent steps, I’ve found that it works best to export the data types into their own separate DXF files, rather than all together. Click on Export at the top, and a new browser window will open with the DXF content in a text box:

KML2x interface to convert KML file to DXF Autocad file

Select the text in the box, copy it into your favorite text editor, then save it as a DXF file (*.DXF).

Next comes the conversion to shapefiles. For this, you can use a DXF to shape converter available either as a plug-in for MapWindow GIS, or as a stand-alone application; the process below and the screenshot are for the MapWindow plug-in version. Select “Import AutoCAD DXF File” from the “Importers” menu (if it’s not visible, check to make sure it’s been enabled in the “Plug-ins” menu, and installed properly in the plugins directory). The following window will come up:

Converting DXF Autocad file to shapefile with MapWindow

Specify the input file, the name and location of the shapefile to be created, and select the filetype that matches the input file. You can create and save a log file in the process by checking the appropriate box, and you can also add the newly-created shapefile to the current view in MapWindow by checking the box at the bottom. Click on Convert, and the shapefile should be created. Here’s a screenshot from MapWindow of the three shapefiles (point, line and polygon) exported from the original KML file into DXF format, then converted into shapefile format:

KML file converted to shapefile via DXF

Don’t forget that positions in Google Earth can be displaced from their true positions by a significant amount.


Looking for something else? Enter some keywords below, then click "Search".    




13 Responses to “Another Way To Convert Google Earth KML Files To Shapefiles”


  1. 1 Jennifer

    This worked very well for me, thank you for the info.
    I converted from dxf to shp by loading the dxf into ArcMap and exporting it to a shp. This way each data type will come up separately and allow for individual exports without running the kml to dxf tool three times. Just an alternate route.

  2. 2 Leszek Pawlowicz

    Thanks for the tip. You could also use FME or Global Mapper to convert the KML files directly to shapefiles, without an intermediate conversion to DXF, but as with ArcMap, you’d have to buy a copy of the program. It’s not really a “free geotool” if you need a $1500 program to make it work ;-).

  3. 3 Anonymous

    There is a good converter from KML to SHAPEFILE on the ESRI ArcScripts site, just named KML 2 SHP.

  4. 4 Anonymous

    There are two extensions for that convertion, but for the best follow this link:

    http://arcscripts.esri.com/details.asp?dbid=14988

  5. 5 Leszek Pawlowicz

    Yes, but you need to have a copy of ArcGIS to use these, and that doesn’t quite fall in the category of “free” ;-).

  6. 6 Mark

    Hi i need a generic converter which doesn’t need any gis or some software. I just need some info of how and what data is stored in shape file and what are the data from KML fill’s those data in shape?

  7. 7 Leszek Pawlowicz

    For a generic converter that doesn’t need a GIS program for the final step, check this post:

    http://freegeographytools.com/2007/the-last-word-for-now-on-converting-google-earth-kml-files-to-shapefiles

    The only data that gets put into the shapefile’s DBF data table is the name; none of the other data gets saved. All of the additional pieces of data are saved under the same KML tag, so there’s no way to differentiate them.

  8. 8 mark

    Thanks for the reply.I have used that tool. But i want to know what happens behind the tool’s process.Just a brief info on what are the things mapped from KML into Shape parameters.

  9. 9 Leszek Pawlowicz

    You’ll have to talk to the program’s author about the specifics. But AFAIK, the only data that gets mapped over from KML to the shapefile is the name of the KML shape, and the geographic information (point, line or polygon).

  10. 10 mike

    Thanks for the reply

  11. 11 Mohamed

    Hey, this is great. I got what I wanted at the end, who cares about an extra step! Good Work. And Thank you

  12. 12 gssofos
  13. 13 Joe

    I’m not sure if the need for converting a kml TO shp, but you might try the MN DNR Garmin program. Free to use, very painless.

Comments are currently closed; feel free to contact me with questions/issues.