I am trying to create a program to draw polygons in a kml with simpleKML in python, the idea is to send a list of coordinates to create polygons in different zones, but it is not working for me, could you tell me what I am doing wrong...
this is my code:
def Draw(Coordenate):
for cor in Coordenate:
print(cor[0][0], cor[0][1])
pol = kmlA.newpolygon(name=str(cor[0]))
pol.outerboundaryis =[ (float(cor[0][0]), float(cor[0][1])),
(float(cor[1][0]), float(cor[1][1])),
(float(cor[2][0]), float(cor[2][1])),
(float(cor[3][0]), float(cor[3][1])),
(float(cor[4][0]), float(cor[4][1])),
]
pol.style.polystyle.color='990000ff'
pol.style.polystyle.outline = 0
pnt = kmlA.newpoint(name="Kirstenbosch StyleMap", coords=[cor[0]])
kmlA.save("C:/test2.kml")
If the argument to Draw() function is a list of polygon coordinates then as you iterate the list, only need to refer to the coordinate list as the outerboundaryis for a new polygon.
Note the longitude coordinate must appear before the latitude in the coordinate tuples.