当前位置: 首页>>代码示例>>Python>>正文


Python KML_ElementMaker.linearRing方法代码示例

本文整理汇总了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))
开发者ID:MDB22,项目名称:MedExpress,代码行数:48,代码来源:unzip_kmz.py


注:本文中的pykml.factory.KML_ElementMaker.linearRing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。