我正在尝试将默认的黄色图钉放置标记更改为矩形或像素。 运行下面的代码后,我仍然得到默认的黄色图钉放置标记
import simplekml
#from simplekml import Shape,Color
kml = simplekml.Kml()
pt2=kml.newpoint(name="test", coords=[(18.432314,-33.988862)])
#both code below are not working.
pt2.style.iconstyle.icon.shape='rectangle'
pt2.style.iconstyle.shape='rectangle'
pt2.style.iconstyle.color='ffffff00'
kml.save("test.kml")
要更改图标的形状,请更改图标URL的iconstyle的href属性。可以查看在Google Earth中使用的图标列表here
在上面发布的代码中,“shape”既不是icon的属性,也不是iconstyle的一部分。icon和iconstyle属性的结构由KML spec定义
已更新代码以使用自定义图标样式输出KML:
相关问题 更多 >
编程相关推荐