Extracting desired values from KML file using QGIS?
There is a QGIS Plugin available which "looks at the KML description field to see if there are two column tables with entries, "tag=value" pairs, or "tag: value" pairs that could be expanded into table fields."
KML Tools: https://plugins.qgis.org/plugins/kmltools/
This looks like a typical KML file exported from ArcGIS or similar GIS software, where the KML export tools take all the attribute data and lump them into an HTML blob (including the table, colors and other formatting) in each KML feature's description tag. This is unfortunate, since now you can not easily extract the attributes back out to name/value pairs.
Other KML generation tools do a better job at this by utilizing ExtendedData (with or without a schema defined), which saves the attributes as name/value pairs in each KML feature (Placemark,etc.). That makes it much easier to reverse the process and extract the attributes, as you're attempting to do, plus the attribute data can still create nice balloon content by referencing it via a balloon template containing $[variables]. More info on ExtendedData in the documentation: https://developers.google.com/kml/documentation/extendeddata
So you have a few options, depending on your situation:
- Get access to the source data, which likely was in a shapefile or other format with the attributes split out.
- Re-generate the KML with the attributes in ExtendedData (only relevant if you can influence the file's creator).
- Pull the HTML blob out of each KML feature, and parse it to extract the attribute names & values. There are many ways to do this, and the best technique will depend on which software and scripting tools you have available.
Sorry I don't know of a quick & easy tool to do this, but the question has been asked online numerous times, so you might find more ideas through targeted searching.