Python Forum

Full Version: simplekml change shape&color
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to change the newpoint default shape , the code below return no errors but the result still using default Yellow shape in Googlmap.
.I wanted to change it to RED Rectangular shape.
Huh Cry
import simplekml 

''' code below doesn't work either.
from simplekml import *
from simplekml import Shape, Color
'''
kml = simplekml.Kml()
kml.shape='rectangle'
kml.color='r'
kml.newpoint(name="test", coords=[(18.432314,-33.988862)])
kml.save("test.kml")
help~
import simplekml

kml = simplekml.Kml()
pt2 = kml.newpoint(name="test", coords=[(18.432314,-33.988862)])
# use square icon
pt2.style.iconstyle.icon.href = 'http://maps.google.com/mapfiles/kml/shapes/placemark_square.png'
# set color of icon to be cyan (RGB=#00ffff)
pt2.style.iconstyle.color ='ffffff00' # aabbggrr
print("Output: test.kml")
kml.save("test.kml")