To have the shapefile built with the proper crs. Why don’t you directly convert a KML file to PostGIS. Currently I’m using ogr2ogr to do the conversion for me, but it wipes out all the attribute data. Its an open source commandline tool. The layer file maintains the symbology found within the original KML or KMZ file. Converts a KML or KMZ file into feature classes and a layer file.
- It supports complex geometries, and is able to present much of the KML as attribute data.
- As with all new tools, review the documentation on prior to use.
- I do not want to upload the tracking data to yet another website for the conversion.
- Because KML will (should) always be in geographic coordinates (WGS84), you will eventually want to transform them to UTM Zone 15N NAD83…
- Other GIS display/edit tools can be used to avoid these arduous extra steps.
Quantum GIS
From your code snippet, I think your task is to convert a KML and reproject it. But when (it seems) when selecting the file in the GDB, the problem occurs. Any other way to directly dump KML to PostGIS (all data in single table)
Converting between KML and shapefile (SHP) format
Use OGR for command line control, Google Earth Pro will give you a graphical way to convert, as will a variety of other apps There is also the option to do batch conversion when you have a large set of KML files from your users. FME posted a beta for an online tool that handles many different types of conversion, including this. 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.
Preserving attributes during kml2shp conversion in ArcGIS for Desktop?
You can go from the feature class or layer (created by that tool) to a shapefile using Copy Features (or Export Data in the Table of Contents). Not the operating system you want, but BaseCamp by Garmin can read your kml file, and exporting to csv gives a file that can be added with delimited text to QGIS. I would like to convert the .kml file into a Shapefile.
Is not imported by GDAL and Qgis Master, while Is there a way I can keep this information? To each point there is information, such as Name, Power, Age (it’s a map of hydroenergy powerplants). I have a KML file with hundreds of points. By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy. As others have mentioned (including the horse’s mouth), apparently ESRI excluded code to translate the Attributes, so to use ArcMap the user has to go through extra steps to split the data then rejoin it in ArcMap.
Converting KML to shapefile without losing attributes using QGIS
Converter also supports more than 90 others vector and rasters GIS/CAD formats and more than coordinate reference systems. If you have the interop extension just load that KML straight into ArcMap and export to shp. If you have ArcGIS, you can access this via the Data Interoperability Extension (list of formats) at additional cost. For proprietary applications, Safe Software’s FME gives you amazing control over how you map the source information into destination. 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.
Simple script to batch-convert KML to SHP or G duplicate
Your question is almost idential to How to convert between KML and Esri’s shapefile (SHP) format? KML2Shapefile is a plugin to MapWindow GIS that converts Google Earth KML and KMZ files into shapefiles for use in a GIS. How to convert between KML and Esri’s shapefile (SHP) format?
How to convert KML with tracks to Shapefiles?
The shapefile will be created in the same directory as the corresponding kml. It is based on ogr2ogr (gdal/ogr library) – so almost all known daman game online GIS formats and coordinate systems are supported… 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.
Once I had gotten that going, running ogr2ogr -f “ESRI Shapefile” foo.shp foo.kml gave me a shapefile that qgis was able to import, preserving the ExtendedData attributes. Is there a way to convert a .kml file into a .csv to check the attributes or a .shp to import it straight into ArcMap? I am currently trying to import a batch of kml files in R and to create a single shapefile. You can use Global Mapper software in which you can easily export/import kml/kmz files + attach data and lots of vector and raster formats. If you would like to convert your files online, try MyGeodata GIS formats and coordinate system converter. But if kml files imported have points lines and polygons together, what’s the correct st_write options?
As with all new tools, review the documentation on prior to use. Use ogr2ogr, but if you’re not interested in a command line, try ogr2gui – a really simple front end for ogr2ogr. I’ve used this to take the oil spill kml feeds from Google and convert them into SHP. ArcGIS 10 has a GP tool called KML To Layer that converts KML to a feature class. Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. You can directly download the Poster Map in PDF format.
- Any idea why ogr is giving me these errors?
- Once you add it to your toolbox and understand its limitations, the tool is very straight forward to use.
- How to convert between KML and Esri’s shapefile (SHP) format?
- MapWindow has a KML2Shapefile plugin, though.
- If you have the interop extension just load that KML straight into ArcMap and export to shp.
Use the KML To Layer tool which you can find and open via the Search window or in ArcToolbox under the Conversion Tools. I finally found a script which converts KML to GPX. That means that almost every form of data storage is allowed, as long as it is valid XML. 3.) Select imported track and export to external storage as GPX, CSV or TCX. So imported the .kmzto MyTracks , exported the track as .gpx and was finally able to import the .gpx to QGIS.
Thanks for contributing an answer to Geographic Information Systems Stack Exchange! Other GIS display/edit tools can be used to avoid these arduous extra steps. 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. Free Geography Tools covers and provides a tutorial of Zonums Software tool
If you are interested in command line tools, you can use GDAL/OGR from OSGEO. 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. It includes both a GUI (which express format-to-format translations and more customized schema mapping translations) as well as a commandline tool. This falls in the category of view, convert, re-project almost any geographic data you can imagine. The University of Connecticut has a published a script for creating shapefiles from KML called KML_to_Shp.tbx. 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).
The Open Source MapWindow GIS has a free extension (KML2Shapefile) for converting KML/KMZ files into shapefiles. ET GeoWizards also has an import from Google Earth option, which will convert KML or KMZ files to feature class. To use spatial data published as a KML or KMZ file in ArcGIS you must first convert the KML to a feature class (shapefile). 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.
MapWindow has a KML2Shapefile plugin, though. Then I used the command line command My end goal is to save the KML file out of QGIS as a shape file to send to my client after I had manipulated it. Connect the items and on the write select (copy attributes from feature types) After this just use QGIS (the key is “new” version – included GDAL Version 1.9.2 onwards) and “Add vector layer” and layer will load with all “ExtendedData”.

Leave a Reply
Want to join the discussion?Feel free to contribute!