[GIS] Converting KML to shapefile without losing attributes using QGIS

importkmlqgis

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:

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

Best Answer

The ExtendedData does not have correct "name" values.

For example

<Data><displayName>System</displayName><value>Riverine</value></Data>

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

Related Question