I am new to Python programing language. I have created the codes, based on this solution.
I prepared two simple programs:
import simplekml
List2 = [ [ 'Placemark','old file', 51.500152, -0.126236 ] ] # description, lat, lon
List3 = [ [ 'New placemark','new file', 51.600152, -0.136236 ] ]
kml = simplekml.Kml()
for row in List2:
kml.newpoint(name=row[0], description=row[1],
coords=[(row[3], row[2])]) # lon, lat, optional height
for row in List3:
kml.newpoint(name=row[0], description=row[1],
coords=[(row[3], row[2])])
kml.save("test2.kml")
and from another file here:
import simplekml
kml = simplekml.Kml()
kml.newpoint(name="Kirstenbosch", description="Description", coords=[(18.432314,-33.988862)]) # lon, lat,optional height
kml.newpoint(name="Kirstenbosch2", description="<b> Botanic garden </b> in South Africa", coords=
[(18.532314,-33.788862)])
kml.save("output/botanicalgarden2.kml")
I know that this code (simplekml tool
) can be used for the bulk .kml
data, as it was mentioned here.
Could you tell me how to write this code not repeatedly, as I did? I would like to have a multitude of place mark locations within one list/new point, when possible.
(lon, lat)
, instead of(lat, lon)
, because it maps to the common way to put(x, y)
coordinates for plotting... \$\endgroup\$