April 2018
Intermediate to advanced
408 pages
10h 42m
English
We'll start by parsing an Extensible Markup Language (XML) file to get the raw latitude and longitude pairs. This will show you how we can encapsulate some not-quite-functional features of Python to create an iterable sequence of values.
We'll make use of the xml.etree module. After parsing, the resulting ElementTree object has a findall() method that will iterate through the available values.
We'll be looking for constructs, such as the following XML example:
<Placemark><Point> <coordinates>-76.33029518659048, 37.54901619777347,0</coordinates> </Point></Placemark>
The file will have a number of <Placemark> tags, each of which has a point and coordinate structure within it. This is typical of Keyhole Markup Language