當前位置: 首頁>>代碼示例>>Python>>正文


Python Kml.newmultigeometry方法代碼示例

本文整理匯總了Python中simplekml.Kml.newmultigeometry方法的典型用法代碼示例。如果您正苦於以下問題:Python Kml.newmultigeometry方法的具體用法?Python Kml.newmultigeometry怎麽用?Python Kml.newmultigeometry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在simplekml.Kml的用法示例。


在下文中一共展示了Kml.newmultigeometry方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MultiGeometry

# 需要導入模塊: from simplekml import Kml [as 別名]
# 或者: from simplekml.Kml import newmultigeometry [as 別名]
"""
Demonstrates three types of MultiGeometry (point, linestring and polygon) using the South Africa coordinate system as a basis.
"""

import os
from simplekml import Kml, Color

kml = Kml(name="MultiGeometry", open=1)

# Creating MultiGeometry
multipnt = kml.newmultigeometry(name="MultiPoint") # SA (Hartebeeshoek94) Grid Intersections
multilin = kml.newmultigeometry(name="MultiLine") # SA (Hartebeeshoek94) Lo. Lines
multipolodd = kml.newmultigeometry(name="MultiPolyOdd") # SA (Hartebeeshoek94) Lo. Regions
multipoleven = kml.newmultigeometry(name="MultiPolyEven") # SA (Hartebeeshoek94) Second Lo. Regions for styling
lolabels = kml.newfolder(name="Lo. Regions") # The labels of the Lo. Regions (17-33)

# Create all the coordinates to populate the South African Coordinate System
polycoordsodd = []
polycoordseven = []
firstrun = True
for x in range(16, 36, 2):
    linecoords = []
    if x < 34: # Label region
        lo = lolabels.newpoint(name=str(x+1), coords=[(x+1, -29)])
        lo.iconstyle.icon.href = "" # Remove the icons
    for y in range(-35, -19, 2):
        multipnt.newpoint(coords=[(x, y)])
        linecoords.append((x,y))
    multilin.newlinestring(coords=linecoords)
    polycoordsodd.append(linecoords)
    if len(polycoordsodd) == 2:
開發者ID:PseudoAj,項目名稱:simplekml,代碼行數:33,代碼來源:T03+MultiGeometry.py


注:本文中的simplekml.Kml.newmultigeometry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。