Solved Google Earth KML Parser - Ignoring irrelevant header/fields (1 Viewer)

ironfelix717

Registered User.
Local time
Today, 18:18
Joined
Sep 20, 2019
Messages
92
Hi,

I'm not well versed in XML. But I need to parse a KML from Earth, mainly to extract the following data:

*Only extracting placemarks - no paths or other geometry
-Name of Placemark
-Lat/Long Cord
-Description of placemark
-Placemark style ID

Side Note: I have been able to parse the Name and Cord, but the Description and Style ID, I don't know what namespace (xpath) to reference to get that data.

Core problem:
I was able to pull together some resources and modify a function to parse a KML, the problem is, I need a cleaner result returned. The current approach returns not just the placemarks, but it also returns.... name of the document and name of any folders that exist in the XML structure, which causes havoc when trying to streamline this process and return adjacent data that is also accurate.

I simply want: a name, cordinate (plus description & styleID) to be returned for every placemark in the file. I intend to automate this process and can't have data mismatched when I join the names + coordinates in say, a table or something.

See attached for example of the function and problem at hand,


-Regards
 

Attachments

  • KML Parse Example.zip
    187.2 KB · Views: 12

ironfelix717

Registered User.
Local time
Today, 18:18
Joined
Sep 20, 2019
Messages
92
Solved:

 

Users who are viewing this thread

Top Bottom