本文整理汇总了Python中pykml.factory.KML_ElementMaker.y方法的典型用法代码示例。如果您正苦于以下问题:Python KML_ElementMaker.y方法的具体用法?Python KML_ElementMaker.y怎么用?Python KML_ElementMaker.y使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pykml.factory.KML_ElementMaker
的用法示例。
在下文中一共展示了KML_ElementMaker.y方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_camera_model_placemark
# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import y [as 别名]
def create_camera_model_placemark(location):
pm = KML.Placemark(
KML.description(
'<table border="1">'
'<tr><th>latitude</th><td>{lat}</td>'
'<tr><th>longitude</th><td>{lon}</td>'
'<tr><th>altitude</th><td>{alt}</td>'
'<tr><th>heading</th><td>{head}</td>'
'<tr><th>tilt</th><td>{tilt}</td>'
'<tr><th>roll</th><td>{roll}</td>'
'</table>'.format(
lat=location['loc'].latitude,
lon=location['loc'].longitude,
alt=location['loc'].altitude,
head=location['loc'].heading,
tilt=location['loc'].tilt,
roll=location['loc'].roll,
)
),
KML.Model(
KML.altitudeMode('relativeToGround'),
KML.Location(
KML.latitude(location['loc'].latitude),
KML.longitude(location['loc'].longitude),
KML.altitude(location['loc'].altitude),
),
KML.Orientation(
KML.heading(location['loc'].heading),
KML.tilt(-location['loc'].tilt),
KML.roll(location['loc'].roll),
),
KML.Scale(
KML.x(10),
KML.y(10),
KML.z(-10),
),
KML.Link(
KML.href('models/three_unit_lines.dae'),
)
)
)
return pm
示例2: main
# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import y [as 别名]
def main():
# iterate through 24 hours, adding ephemeris data to a list
data = []
for hour in range(0, 24):
obs.date = date = datetime(year, month, day) + timedelta(hours=hour)
sun.compute(obs)
data.append({
'datetime UTC': date,
'azimuth_angle': sun.az.real,
'altitude_angle': sun.alt.real,
})
# 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,
)
)
)
# create placemark for the observer, and add it to the KML document
pm_observer = KML.Placemark(
KML.name('Observer'),
KML.styleUrl('#{0}'.format(stylename)),
KML.Point(
KML.extrude(True),
KML.altitudeMode('relativeToGround'),
KML.coordinates("{0},{1},{2}".format(longitude, latitude, height)),
),
)
doc.Document.append(pm_observer)
# iterate through the ephemeris data
for i in data:
timestamp = i['datetime UTC']
azimuth_rad = i['azimuth_angle']
azimuth_deg = degrees(azimuth_rad)
altitude_rad = i['altitude_angle']
altitude_deg = degrees(altitude_rad)
if altitude_deg > 0:
# define a placemark along the ephemeris vector for labeling
delta_lat_rad, delta_lon_rad, delta_alt = calculate_geographic_offset(
azimuth_angle=radians(adjust_heading_degrees(degrees(azimuth_rad))),
altitude_angle=altitude_rad,
distance=label_distance,
)
pm1 = KML.Placemark(
KML.name((timestamp + timedelta(timezone_offset)).strftime('%H:%M')),
KML.styleUrl('#{0}'.format(stylename)),
KML.LookAt(
KML.longitude(longitude),
KML.latitude(latitude),
KML.altitude(height),
KML.heading(adjust_heading_degrees(azimuth_deg)),
KML.tilt(90),
# KML.roll(0),
KML.altitudeMode("relativeToGround"),
KML.range(50),
),
KML.Point(
KML.altitudeMode("relativeToGround"),
KML.coordinates("{lon},{lat},{alt}".format(
lon=longitude + degrees(delta_lon_rad),
lat=latitude + degrees(delta_lat_rad),
alt=height + delta_alt,
)),
),
)
pm2 = KML.Placemark(
KML.name('Sun View'),
KML.LookAt(
KML.longitude(longitude),
KML.latitude(latitude),
KML.altitude(height),
KML.heading(adjust_heading_degrees(180 + azimuth_deg)),
KML.tilt(90 - altitude_deg - 0.2),
# KML.roll(0),
KML.altitudeMode("relativeToGround"),
KML.range(2 * label_distance),
),
KML.Model(
KML.altitudeMode('relativeToGround'),
KML.Location(
KML.longitude(longitude),
KML.latitude(latitude),
KML.altitude(height),
),
KML.Orientation(
KML.heading(adjust_heading_degrees(azimuth_deg)),
KML.tilt(90 - altitude_deg),
KML.roll(0),
),
KML.Scale(
#.........这里部分代码省略.........
示例3:
# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import y [as 别名]
),
KML.Model(
KML.altitudeMode('relativeToGround'),
KML.Location(
KML.longitude(longitude),
KML.latitude(latitude),
KML.altitude(height),
),
KML.Orientation(
KML.heading(adjust_heading_degrees(azimuth_deg)),
KML.tilt(90-altitude_deg),
KML.roll(0),
),
KML.Scale(
KML.x(1000),
KML.y(1000),
KML.z(500000),
),
KML.Link(
KML.href('unit_cone_red.dae'),
),
),
)
doc.Document.append(
KML.Folder(
KML.name(timestamp.strftime('%Y-%m-%dT%H:%MZ')),
pm1,
pm2,
KML.TimeStamp(
KML.when((timestamp).strftime('%Y-%m-%dT%H:%MZ')),
),