I have a KML file with hundreds of points. To each point there is information, such as Name, Power, Age (it's a map of hydroenergy powerplants). If I import that KML file to QGIS, this information is lost.

Is there a way I can keep this information?

The Information looks like this:

 <SchemaData schemaUrl="#vorlage">
  <SimpleData name="Name">Test</SimpleData>
  <SimpleData name="Power">10895</SimpleData>
  <SimpleData name="Location">L</SimpleData>

12 Answers 12


The ExtendedData does not have correct "name" values.

For example


is not imported by GDAL and Qgis Master, while

<Data name="System"><displayName>System</displayName><value>Riverine</value></Data>

gets imported.

You can change that with a good text editor.

For KML edit it is needed to use text editor which allows "Regular Expression" in Replace function like PSPad (or Notepad++ and many other free text editors)

Find: <Data><displayName>(.*)</displayName>

Replace: <Data name="$1"><displayName>$1</displayName>

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".


It appears that Google's libkml does not ship with GDAL 1.9.2 on Ubuntu, specifically gdal-bin 1.9.2-2~precise4:

$ ogrinfo --formats | grep -i kml
  -> "KML" (read/write)

To get a version working with libkml and ExtendedData support, I had to build GDAL from svn trunk (r25473) after building libkml from svn trunk (r864), noting specifically that the 1.2.0 release is apparently not sufficient, as documented on the GDAL website. Beware that installing libkml0 on Ubuntu precise (currently 1.2.0-1ubuntu6) will not help. You really do need 1.3 or svn trunk, for which I was not able to find a PPA.

I was ultimately unable to even build libkml on Ubuntu precise; there are type errors in the version of boost that ships with it, and there are errors running libtool as the dependencies are out of order. For whatever reason, these were not an issue on Debian squeeze, where I did succeed:

$ ogrinfo --formats | grep -i kml
  -> "LIBKML" (read/write)
  -> "KML" (read/write)

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.


I converted one of the wetlandfiles with globalmapper to shape: enclosed two screenshots from converted dbf-files (areas and lines):

enter image description here

enter image description here


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.


Using FME 2012 (SP4)

Load the Reader KML

Select a Writer (Shapefile)

connect the items and on the write select (copy attributes from feature types)

Run the workspace

enter image description here


The Ogr2ogr kml driver used by Qgis 1.8.0 Lisboa does not support kml ExtendedData tags.

The LIBKML driver does, it is incorporated in GDAL Version 1.9.2 onwards, OSGEO4W packages, MS4W and Qgis Master.

Your data is not wrong, but LIBKML driver in OSGeo4W had some problems with SchemaData. Alternatively, the following works:

 <Data name="Name"><value>Test</value></Data> 
 <Data name="Power"><value>10895</value></Data>
 <Data name="Location"><value>L</value></Data> 

The SchemaData bug is now fixed in GDAL 1.9.2-2 package of OSGEO4W.


You could try kml2shp.

They have a new online converter as well.


I was unable to resolve this. No matter what version of QGIS I used, no matter how I formatted the ExtendedData, I was unable to get it to import this data.

So I found a work around. 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. So based on this post about converting a KML file to shape file. How to convert between KML and Esri's shapefile (SHP) format?

I got GDAL installed based on the instructions here.


Then I used the command line command

ogr2ogr -f "ESRI Shapefile" output.shp FileName.kml

The output.shp does not need to be an existing file.

Imported the output.shp into QGIS and the table had my extended data along with a lot of other attributes that I'm not sure where they came from.


I don't know you can achieve that with QGIS. MapWindow has a KML2Shapefile plugin, though.

KML2Shapefile is a plugin to MapWindow GIS that converts Google Earth KML and KMZ files into shapefiles for use in a GIS.

KML2Shapefile will split each KML geometry type into a separate shapefile. It supports complex geometries, and is able to present much of the KML as attribute data.

MapWindow is a free and open source GIS package too, by way. You can download and install it for free. You can convert the KML to shapefile using the KML2Shapefile plugin in MapWindow and just load the resulting shape file in QGIS. Assuming you're on Windows anyway.

Best solution I can think of for now. I hope somebody knows of a plugin to do it in QGIS though.


Get Global Mapper, all you have to do is bring in the KMZ or KML then export Vector IMG (ESRI SHP File). Global mapper can read most file types. Then open the shape in ARC, Global mapper, Manifold, QGIS, ect and view the attribute table. All info will be there. you can also open up the DBF file from the SHP with Microsoft Excel at this point and then save as XLXS file extention if you wanted too.


In QGIS 3.2.0 convertion can be easlity made using the Toolbox.

Select in Toolbox -> GDAL -> Vector Convertion -> Convert Format.... (Caja de Herramientas de Procesos -> GDAL -> Conversión Vectorial -> Convertir Formato)

Select KML file, save as SHP file. I also had to change the resulkting file ("Converted") in the Properties -> Source (Tab) -> Source Coding from "UTF-8" to "Windows-1258" to properly see the spanish characters.


Nowadays there's a Plugin that works well and can do this: KML Tools

KML Tools

Once installed, you find it in Vector Menu. Click on "Expand HTML Description Field". It even lets you choose between different ways of expanding the table, the default worked well for me.

Expand HTML Description Field

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