本文整理汇总了Python中simplekml.Kml.newgroundoverlay方法的典型用法代码示例。如果您正苦于以下问题:Python Kml.newgroundoverlay方法的具体用法?Python Kml.newgroundoverlay怎么用?Python Kml.newgroundoverlay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simplekml.Kml
的用法示例。
在下文中一共展示了Kml.newgroundoverlay方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_kml
# 需要导入模块: from simplekml import Kml [as 别名]
# 或者: from simplekml.Kml import newgroundoverlay [as 别名]
def make_kml(llcrnrlon, llcrnrlat, urcrnrlon, urcrnrlat,
figs, colorbar=None, **kw):
"""TODO: LatLon bbox, list of figs, optional colorbar figure,
and several simplekml kw..."""
kml = Kml()
altitude = kw.pop('altitude', 1e0) #2e7)
roll = kw.pop('roll', 0)
tilt = kw.pop('tilt', 0)
altitudemode = kw.pop('altitudemode', AltitudeMode.relativetoground)
camera = Camera(latitude=np.mean([urcrnrlat, llcrnrlat]),
longitude=np.mean([urcrnrlon, llcrnrlon]),
altitude=altitude, roll=roll, tilt=tilt,
altitudemode=altitudemode)
kml.document.camera = camera
draworder = 0
for fig in figs: # NOTE: Overlays are limited to the same bbox.
draworder += 1
ground = kml.newgroundoverlay(name='GroundOverlay')
ground.draworder = draworder
ground.visibility = kw.pop('visibility', 1)
ground.name = kw.pop('name', 'overlay')
#ground.color = kw.pop('color', '9effffff') ##kw.pop('color', '9effffff')
ground.atomauthor = kw.pop('author', 'PyHum')
ground.latlonbox.rotation = kw.pop('rotation', 0)
ground.description = kw.pop('description', 'Matplotlib figure')
ground.gxaltitudemode = kw.pop('gxaltitudemode',
'clampToSeaFloor')
ground.icon.href = fig
ground.latlonbox.east = llcrnrlon
ground.latlonbox.south = llcrnrlat
ground.latlonbox.north = urcrnrlat
ground.latlonbox.west = urcrnrlon
if colorbar: # Options for colorbar are hard-coded (to avoid a big mess).
screen = kml.newscreenoverlay(name='ScreenOverlay')
screen.icon.href = colorbar
screen.overlayxy = OverlayXY(x=0, y=0,
xunits=Units.fraction,
yunits=Units.fraction)
screen.screenxy = ScreenXY(x=0.015, y=0.075,
xunits=Units.fraction,
yunits=Units.fraction)
screen.rotationXY = RotationXY(x=0.5, y=0.5,
xunits=Units.fraction,
yunits=Units.fraction)
screen.size.x = 0
screen.size.y = 0
screen.size.xunits = Units.fraction
screen.size.yunits = Units.fraction
screen.visibility = 1
kmzfile = kw.pop('kmzfile', 'overlay.kmz')
kml.savekmz(kmzfile)
示例2: make_kml
# 需要导入模块: from simplekml import Kml [as 别名]
# 或者: from simplekml.Kml import newgroundoverlay [as 别名]
def make_kml(llcrnrlon, llcrnrlat, urcrnrlon, urcrnrlat,
figs, colorbar=None, times=None, **kw):
"""
TODO: LatLon bbox, list of figs, optional colorbar figure,
and several simplekml kw...
TJL - Obtained from
http://ocefpaf.github.io/python4oceanographers/blog/2014/03/10/gearth/
"""
if not SIMPLEKML_FLAG:
print '***ERROR!***'
print 'simplekml not installed, download from',\
'https://pypi.python.org/pypi/simplekml/'
return
kml = Kml()
altitude = kw.pop('altitude', 2e7)
roll = kw.pop('roll', 0)
tilt = kw.pop('tilt', 0)
altitudemode = kw.pop('altitudemode', AltitudeMode.relativetoground)
camera = Camera(latitude=np.mean([urcrnrlat, llcrnrlat]),
longitude=np.mean([urcrnrlon, llcrnrlon]),
altitude=altitude, roll=roll, tilt=tilt,
altitudemode=altitudemode)
kml.document.camera = camera
draworder = 0
for fig in figs: #NOTE: Overlays are limited to the same bbox.
draworder += 1
ground = kml.newgroundoverlay(name='GroundOverlay')
ground.draworder = draworder
ground.visibility = kw.pop('visibility', 1)
ground.name = kw.pop('name', 'overlay')
ground.color = kw.pop('color', '9effffff')
ground.atomauthor = kw.pop('author', 'ocefpaf')
ground.latlonbox.rotation = kw.pop('rotation', 0)
ground.description = kw.pop('description', 'Matplotlib figure')
ground.gxaltitudemode = kw.pop('gxaltitudemode',
'clampToSeaFloor')
if times:
ground.timespan.begin = times[0]
ground.timespan.end = times[1]
ground.icon.href = fig
#TJL - swapping west/east to match LL vs. UR properly
ground.latlonbox.west = llcrnrlon
ground.latlonbox.south = llcrnrlat
ground.latlonbox.north = urcrnrlat
ground.latlonbox.east = urcrnrlon
if colorbar: # Options for colorbar are hard-coded (to avoid a big mess).
screen = kml.newscreenoverlay(name='ScreenOverlay')
screen.icon.href = colorbar
screen.overlayxy = OverlayXY(x=0, y=0,
xunits=Units.fraction,
yunits=Units.fraction)
screen.screenxy = ScreenXY(x=0.015, y=0.075,
xunits=Units.fraction,
yunits=Units.fraction)
screen.rotationXY = RotationXY(x=0.5, y=0.5,
xunits=Units.fraction,
yunits=Units.fraction)
screen.size.x = 0
screen.size.y = 0
screen.size.xunits = Units.fraction
screen.size.yunits = Units.fraction
screen.visibility = 1
kmzfile = kw.pop('kmzfile', 'overlay.kmz')
kml.savekmz(kmzfile)
示例3: overlays
# 需要导入模块: from simplekml import Kml [as 别名]
# 或者: from simplekml.Kml import newgroundoverlay [as 别名]
"""
Demonstrates the basics of overlays (ground screen and photo overlay).
"""
import os
from simplekml import Kml, OverlayXY, ScreenXY, Units, Camera, AltitudeMode, ViewVolume
kml = Kml(name="Overlays", open=1)
# GroundOverlay
ground = kml.newgroundoverlay(name='GroundOverlay Test')
ground.icon.href = 'http://simplekml.googlecode.com/hg/samples/resources/smile.png'
ground.gxlatlonquad.coords = [(18.410524,-33.903972),(18.411429,-33.904171),(18.411757,-33.902944),(18.410850,-33.902767)]
# or
#ground.latlonbox.north = -33.902828
#ground.latlonbox.south = -33.904104
#ground.latlonbox.east = 18.410684
#ground.latlonbox.west = 18.411633
#ground.latlonbox.rotation = -14
# ScreenOverlay
screen = kml.newscreenoverlay(name='ScreenOverlay Test')
screen.icon.href = 'http://simplekml.googlecode.com/hg/samples/resources/simplekml-logo.png'
screen.overlayxy = OverlayXY(x=0,y=1,xunits=Units.fraction,yunits=Units.fraction)
screen.screenxy = ScreenXY(x=15,y=15,xunits=Units.pixel,yunits=Units.insetpixels)
screen.size.x = -1
screen.size.y = -1
screen.size.xunits = Units.fraction
screen.size.yunits = Units.fraction
# PhotoOverlay
示例4: make_kml
# 需要导入模块: from simplekml import Kml [as 别名]
# 或者: from simplekml.Kml import newgroundoverlay [as 别名]
def make_kml(extent,figs,colorbar=None, **kw):
"""
Parameters
----------
extent : tuple
(lm,lM,Lm,LM)
lower left corner longitude
upper right corner longitude
lower left corner Latitude
upper right corner Latitude
altitude : float
altitudemode :
roll : float
tilt : float
visibility : int
"""
lm = extent[0]
lM = extent[1]
Lm = extent[2]
LM = extent[3]
kml = Kml()
altitude = kw.pop('altitude', 2e6)
roll = kw.pop('roll', 0)
tilt = kw.pop('tilt', 0)
altitudemode = kw.pop('altitudemode', AltitudeMode.relativetoground)
camera = Camera(latitude = np.mean([Lm, LM]),
longitude = np.mean([lm, lM]),
altitude = altitude,
roll=roll,
tilt=tilt,
altitudemode=altitudemode)
kml.document.camera = camera
draworder = 0
for fig in figs: # NOTE: Overlays are limited to the same bbox.
draworder += 1
ground = kml.newgroundoverlay(name='GroundOverlay')
ground.draworder = draworder
ground.visibility = kw.pop('visibility', 1)
ground.name = kw.pop('name', 'overlay')
ground.color = kw.pop('color', '9effffff')
ground.atomauthor = kw.pop('author', 'author')
ground.latlonbox.rotation = kw.pop('rotation', 0)
ground.description = kw.pop('description', 'matplotlib figure')
ground.gxaltitudemode = kw.pop('gxaltitudemode', 'clampToSeaFloor')
ground.icon.href = fig
ground.latlonbox.east = lM
ground.latlonbox.south = Lm
ground.latlonbox.north = LM
ground.latlonbox.west = lm
if colorbar: # Options for colorbar are hard-coded (to avoid a big mess).
screen = kml.newscreenoverlay(name='ScreenOverlay')
screen.icon.href = colorbar
screen.overlayxy = OverlayXY(x=0, y=0,
xunits=Units.fraction,
yunits=Units.fraction)
screen.screenxy = ScreenXY(x=0.015, y=0.075,
xunits=Units.fraction,
yunits=Units.fraction)
screen.rotationXY = RotationXY(x=0.5, y=0.5,
xunits=Units.fraction,
yunits=Units.fraction)
screen.size.x = 0
screen.size.y = 0
screen.size.xunits = Units.fraction
screen.size.yunits = Units.fraction
screen.visibility = 1
kmzfile = kw.pop('kmzfile', 'overlay.kmz')
kml.savekmz(kmzfile)