I am trying to import a KML file to QGIS. The KML source file is about 15mb is comprised of polygons with attribute data. The KML imports fine and polygons display but the attribute data is unreadable - all contained within [Description] field but looks like this:
"<br><br><br>
<table border="1" padding="0">
<tr><td>ID_INT</td><td>NGA0104001</td></tr>
<tr><td>N_sd</td><td>Igbere</td></tr>
<tr><td>Skm2</td><td>3.34</td></tr>
<tr><td>PT2010</td><td>13000</td></tr>"
As I understand it the conversion is handled by GDAL. I'm running QGIS v.1.8 on Ubuntu 12.04, but have built GDAL library 1.10.1 against the libkml library. Even if I attempt to convert to shapefile using the command line ogr2ogr method I still get the description field parsed incorrectly.
I've tried various on-line tools (e.g.http://www.zonums.com/online/kml2shp.php) but my file is too large or description field comes out as above.
As anyone had any success with converting kml to shape and retaining attribute data. I've found the pykml (http://pythonhosted.org/pykml/index.html) library and have been experimenting with it using ipython notebook to see if I could write the kml to a csv file but equally no joy.
The KML is too large to post but here's what it looks like:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>AFNGA_SWAC.kml</name>
<open>1</open>
<Style id="s_ylw-pushpin1">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ff00ffff</color>
<width>3</width>
</LineStyle>
<PolyStyle>
<color>3300ffff</color>
</PolyStyle>
</Style>
<StyleMap id="m_ylw-pushpin1">
<Pair>
<key>normal</key>
<styleUrl>#s_ylw-pushpin1</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#s_ylw-pushpin_hl1</styleUrl>
</Pair>
</StyleMap>
<Style id="s_ylw-pushpin_hl1">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ff00ffff</color>
<width>3</width>
</LineStyle>
<PolyStyle>
<color>3300ffff</color>
</PolyStyle>
</Style>
<Folder>
<name>AFNGA_SWAC</name>
<open>1</open>
<description>1027 Éléments de la couche Afnga_swac</description>
<Placemark>
<name>Aba</name>
<description><![CDATA[<br><br><br>
<table border="1" padding="0">
<tr><td>ID_INT</td><td>NGA0101001</td></tr>
<tr><td>N_sd</td><td>Aba</td></tr>
<tr><td>Skm2</td><td>384.07</td></tr>
<tr><td>PT2010</td><td>1010000</td></tr>]]></description>
<styleUrl>#m_ylw-pushpin1</styleUrl>
<Polygon>
<extrude>1</extrude>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
7.294567000000001,5.00267,0 7.294408999999999,5.002552,0 7.294211,5.002394,0