문제

Recently I've been reading regards the simplekml module that python 2.7 has. So far I've found this to create a point:

import simplekml
kml = simplekml.Kml()
kml.newpoint(name="Kirstenbosch", coords=[(18.432314,-33.988862)])
kml.save("botanicalgarden.kml")

This displays the name Kirstenbosch at the coordinates listed. I've been wondering if this can be extended as it only displays the name.

For example how would I edit the code above to display on the kml screen.

Name 
Coordinates
Population 
Average age 

I've tried adding population =,average age= to the code but It won't display it only displays the name. Can extra information be displayed on the kml?? Can anyone show me how to display the below list on the kml screen in google earth for the following as an example??

['Kirstenbosch',18.432314,-33.988862, 150000, 32]

Which correlates to name coordinates population and average age

올바른 솔루션이 없습니다

다른 팁

Google's description suggests that a placemark can have:

a description that appears in the "balloon" attached to the Placemark.

a name

a point

You can add this information in python using

pnt = kml.newpoint(name="Kirstenbosch", coords=[(18.432314,-33.988862)])
pnt.description = 'population: 150000 age: 32'
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top