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


Python Kml.newfolder方法代碼示例

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


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

示例1: convert

# 需要導入模塊: from simplekml import Kml [as 別名]
# 或者: from simplekml.Kml import newfolder [as 別名]
	def convert(self, output):
		output_filename = '{}.{}'.format(KMLParser.RESULT_FILENAME, output)
		if output in ['kml', 'kmz']: #check if value is in a list
			kmlinstance = Kml()
			folder = kmlinstance.newfolder()
			folder.name = "My Places"
			for name, lat, lon in self.content:#tuples can be decomposed in a for loop. This is the same as "for (x,y,z) in self.content" or "for t in self.content" and then using t[0] etc.
				folder.newpoint(name=name, coords=[(lat,lon)])
			kmlinstance.save( output_filename )
		elif output in ['terminal', 'txt']:
			newcontent = [ '%s\t->\t%.4f %.4f'%(name, float(lat),float(lon)) for name, lat, lon in self.content ] #list comprehensions rock!!
			if output == 'txt':
				f = open(output_filename, 'w')
				f.write( '\n'.join(newcontent) )
				f.close()
			elif output is 'terminal':
				print '\n'.join(newcontent)
		elif output == 'json':
			newcontent = [ {'name': name, 'coordinates': {'latitude':lat, 'longitude':lon} } for name, lat, lon in self.content ]
			f = open(output_filename, 'w')
			json.dump(newcontent, f, indent=2)
			f.close()
開發者ID:diogobernardino,項目名稱:PythonScripts,代碼行數:24,代碼來源:kmlparser.py

示例2: Style

# 需要導入模塊: from simplekml import Kml [as 別名]
# 或者: from simplekml.Kml import newfolder [as 別名]
# Attach the model to the track
trk.model = model_car
trk.model.link.href = car_dae

# Add all the information to the track
trk.newwhen(car["when"])
trk.newgxcoord(car["coord"])

# Style of the Track
trk.iconstyle.icon.href = ""
trk.labelstyle.scale = 1
trk.linestyle.width = 4
trk.linestyle.color = '7fff0000'

# Add GPS measurement marker
fol = kml.newfolder(name="GPS Measurements")
sharedstyle = Style()
sharedstyle.iconstyle.icon.href = 'http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png'

for m in range(len(latitude)):
    if GPS[m]:
        pnt = fol.newpoint(coords = [(longitude[m],latitude[m])])
        pnt.style = sharedstyle

# Saving
kml.savekmz("Extended-Kalman-Filter-CTRA.kmz")


# In[33]:

print('Exported KMZ File for Google Earth')
開發者ID:balzer82,項目名稱:Kalman,代碼行數:33,代碼來源:Extended-Kalman-Filter-CTRA.py

示例3: Kml

# 需要導入模塊: from simplekml import Kml [as 別名]
# 或者: from simplekml.Kml import newfolder [as 別名]
import numpy as np
import zipfile
import crust1
from os import remove
from simplekml import Kml, Style

# Create an instance of Kml
kml = Kml(open=1)
fol = kml.newfolder(name="Crust 1.0")


def convert_to_html(model):
    """
    Takes a model instance and produces an HTML table that represents the
    results in a nice way for us to look at.

    Parameters
    ----------
    model : dict
    Dictionary of layers and their properties as a list in the form of
    [Vp, Vs, rho, thickness, top]

    Returns
    -------
    html_str : str
    Nicely formatted HTML table of the model results.
    """

    layer_labels = ["Water", "Ice", "Upper_Seds.", "Middle_Seds.",
                    "Lower_Seds.", "Upper_Crust", "Middle_Crust",
                    "Lower_Crust", "Mantle"]
開發者ID:jrleeman,項目名稱:Crust1.0,代碼行數:33,代碼來源:make_kmz.py

示例4: Kml

# 需要導入模塊: from simplekml import Kml [as 別名]
# 或者: from simplekml.Kml import newfolder [as 別名]
import os
from simplekml import Kml, ColorMode, AltitudeMode, Style

# Create an instance of Kml
kml = Kml(name="Basics", open=1)

# Create a new document
doc = kml.newdocument(name="A Document")

# Create a nested document
nestdoc = doc.newdocument()
nestdoc.name = "A Nested Document"
nestdoc.description = "\u2013 This is the nested document's description with unicode."

# Create a new folder at the top level
fol = kml.newfolder()
fol.name = "A Folder"
fol.description = "Description of a folder"

# Some sub folders
fol = fol.newfolder(name='A Nested Folder', description="Description of a nested folder")
fol = kml.newfolder(name='Point Tests', description="Description of Point Folder")

# A folder containing points with style
stpnt = fol.newpoint(name="Cape Town Stadium", description='The Cape Town stadium built for the 2010 world cup soccer.', coords=[(18.411102, -33.903486)])
vapnt = fol.newpoint()
vapnt.name = "V&A Waterfront"
vapnt.description = "The V&A Waterfront in Cape Town"
vapnt.coords = [(18.418699, -33.907080)]
vapnt.style.labelstyle.color = 'ff0000ff'
vapnt.labelstyle.scale = 2
開發者ID:PseudoAj,項目名稱:simplekml,代碼行數:33,代碼來源:E01+Basics.py

示例5: MultiGeometry

# 需要導入模塊: from simplekml import Kml [as 別名]
# 或者: from simplekml.Kml import newfolder [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.newfolder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。