Nov-11-2019, 08:48 PM
Hi,
I would like to parse an existing kml file and change some attributes, for instance the color of a polygon.
This is the code I used:
print(f2[0].name) -> gives me the name of the first placemark.
print(f2[0].geometry) -> gives me the coordinates of the polygon of the first placemark.
I don't seem to find a lot of information on fastkml and how the attributes are read.
I would like to add some styles like color to the polygons, but I don't have any clue how to do this.
Can anyone point me to some more information? Ideally some more examples of fastkml would be nice!
Rgds,
Johan.
I would like to parse an existing kml file and change some attributes, for instance the color of a polygon.
This is the code I used:
with open(KMLFILE, 'rt', encoding="utf-8") as myfile: DOC=myfile.read() INPUT = kml.KML() OUTPUT = kml.KML() INPUT.from_string(DOC) FEATURES = list(INPUT.features()) f2 = list(FEATURES[0].features())So far so good.
print(f2[0].name) -> gives me the name of the first placemark.
print(f2[0].geometry) -> gives me the coordinates of the polygon of the first placemark.
I don't seem to find a lot of information on fastkml and how the attributes are read.
I would like to add some styles like color to the polygons, but I don't have any clue how to do this.
Can anyone point me to some more information? Ideally some more examples of fastkml would be nice!
Rgds,
Johan.