本文整理汇总了Python中pykml.factory.KML_ElementMaker.linearRing方法的典型用法代码示例。如果您正苦于以下问题:Python KML_ElementMaker.linearRing方法的具体用法?Python KML_ElementMaker.linearRing怎么用?Python KML_ElementMaker.linearRing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pykml.factory.KML_ElementMaker
的用法示例。
在下文中一共展示了KML_ElementMaker.linearRing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_kml_file
# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import linearRing [as 别名]
def make_kml_file(geofence):
fld = KML.Folder()
geometry_coords = []
# create a KML file skeleton
stylename = "sn_shaded_dot"
doc = KML.kml(
KML.Document(
KML.Name("Sun Position"),
KML.Style(
KML.IconStyle(
KML.scale(1.2),
KML.Icon(
KML.href("http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png")
),
),
id=stylename,
)
KML.Folder(
KML.name("Shrunk Geofence")
)
)
)
for coord in geofence:
str_lat = str(coord.lat)
str_lon = str(coord.lon)
str_comb = "%s,%s,0 " % (str_lat,str_lon)
geometry_coords.append(str_comb)
geometry_string = ''.join(geometry_coords)
doc.Document.Folder.append(KML.Placemark(
KML.Polygon(
KML.outerBoundaryIs(
KML.linearRing(
KML.coordinates(geometry_string)
)
)
)
))
with open("./kml_modGeofence/Shrunk_Geofence.kml", "w") as text_file:
text_file.write(etree.tostring(doc, pretty_print=True))