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:
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:
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:
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:
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:
Don’t forget that positions in Google Earth can be displaced from their true positions by a significant amount.
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.
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 ;-).
There is a good converter from KML to SHAPEFILE on the ESRI ArcScripts site, just named KML 2 SHP.
There are two extensions for that convertion, but for the best follow this link:
Yes, but you need to have a copy of ArcGIS to use these, and that doesn’t quite fall in the category of “free” ;-).
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?
For a generic converter that doesn’t need a GIS program for the final step, check this post:
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.
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.
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).
Thanks for the reply
Hey, this is great. I got what I wanted at the end, who cares about an extra step! Good Work. And Thank you
try this http://www.geosolution.gr/downloads_En.htm
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.