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>

Is there anything wrong with my code?

  • 1
    How are you importing the .kml into QGIS? This format is supported as one of the basic formats, so it should be a relatively painless process to add a kml file as a layer. If you provide more detail, someone may be able to help figure out what is going wrong. Also info about the source of the file may be useful. Sep 19 '12 at 18:12
  • 1
    do you have a live link to the kml?
    – Mapperz
    Sep 19 '12 at 19:34
  • I think it would be possible via FME, or if you feel a little adventurus, you could write a python script that would parse the kml (xml!) and export into shapefile. (libraries to use: python shapefile library, any XML from python)
    – U2ros
    Nov 5 '12 at 7:08
  • 2
    R.K. yes I have seen that one. Though I decided to ask new question with better description of problem because there is no satisfying solution to it. Also after another circle of try the problem can be that the wetlands KML files are not valid KML when tested in online KML validator and come with many errors...
    – Miro
    Nov 5 '12 at 9:05
  • 1
    U2ros I have tried online FME without success. Maybe the desktop FME, I can give it try in the next "install round"... I definitely don't feel adventurous enough to program script which will convert kml to shp :-). But in worst case I can imagine writing script which will go through KML, find "ExtendedData" for every feature and create table/csv which I can join through "name" to converted KML in QGIS/ArcGIS/Mapinfo...
    – Miro
    Nov 5 '12 at 9:16

10 Answers 10


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.

------------------- Added by Miro ---------------------

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

  • Thank you, that was the KEY information. I tried to replace it in one test file and it worked perfect. All "ExtendedData" are now in table as colums. Again thank you very much.
    – Miro
    Nov 7 '12 at 2:02
  • 3
    Actually, DisplayName is not used by Qgis. So replacing can be done without RegExp by replacing <Data><DisplayName> with <Data name=" and replacing </DisplayName> with ">.
    – AndreJ
    Nov 7 '12 at 7:02
  • 1
    My KML file was also containing a tag <SchemaData> that I had to comment in order to open it in QGIS. But otherwise the trick worked perfectly!
    – Djana
    Jun 12 '14 at 7:24

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

hopefully this is what you want ..

  • Thank you, yes that is exactly what I need. Good to know there is software which can handle these KML which are not KML standard compliant. Because there is already other answer how to do it with free QGIS I am not going to try Global Mapper but it can definitely help somebody else. Thank you again.
    – Miro
    Nov 7 '12 at 1:56
  • Really a fantastic converter, cool!!
    – SIslam
    May 24 '15 at 12:07

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..Its one of the best software..


  • Thank you for tip. I believe it can import/export kml/kmz files but I have already tried 5+ apps which can do that. And none of them is able to read attributes ("ExtendedData"). So can actually Global Mapper do that?
    – Miro
    Nov 5 '12 at 7:26

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.


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> 

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


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

  • Thank you, I have downloaded the fme_install.msi but there is error in installation and because there is already different working solution to this question I am not going to continue this way. Anyway thank you again.
    – Miro
    Nov 7 '12 at 1:47

You could try kml2shp?

They have a new online converter as well.


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.

  • 1
    Thanks for your help. I tried that, but still the Data is lost.The Information looks like this: <ExtendedData><SchemaData schemaUrl="#vorlage"> <SimpleData name="Name">Test</SimpleData> <SimpleData name="Power">10895</SimpleData> <SimpleData name="Location">L</SimpleData> </SchemaData></ExtendedData> is there anything wrong with my code?
    – Felix
    Sep 19 '12 at 18:33
  • Oh, sorry about that. I was hoping it would work.
    – R.K.
    Sep 19 '12 at 18:36
  • 1
    @Felix - The information you provided in your comment is really useful. I would recommend editing your question and adding it in there for additional context and clarity. Sep 20 '12 at 0:14
  • @AndreJoost - Sounds like you came up with a good answer. It would be worth adding it as an actual answer so that it will show up in search results of anyone else with the same issue. Sep 20 '12 at 0:15

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.

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.