0
点赞
收藏
分享

微信扫一扫

谷歌气球 simplekml 入门《三》


​​谷歌气球 simplekml 入门《一》​​谷歌气球 simplekml 入门《二》
谷歌气球 simplekml 入门《三》
谷歌气球 simplekml 入门《四》
谷歌气球 simplekml 入门《五》
谷歌气球 simplekml 入门klm解说《六》
谷歌气球 simplekml 入门《七》
谷歌气球 simplekml 《八》地图动画之旋转动画的制作-全网唯一

一、样式 Styles

  • Style

import simplekml
kml = simplekml.Kml()
pnt = kml.newpoint(name='A Point')
pnt.coords = [(1.0, 2.0)]
pnt.style.labelstyle.color = simplekml.Color.red #字体颜色
pnt.style.labelstyle.scale = 2 # 字体大小
pnt.style.iconstyle.icon.href = 'http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png'
kml.save("Style.kml")

balloonstyle¶   气球式,接受simplekml.BalloonStyle。
iconstyle 图标样式,接受simplekml.IconStyle.
labelstyle 标签样式,接受simplekml.LabelStyle.
linestyle 线型,接受simplekml.LineStyle.
liststyle 列表样式,接受simplekml.ListStyle.
polystyle polystyle,接受simplekml.PolyStyle.

  • BalloonStyle 气球样式

import simplekml
kml = simplekml.Kml()
pnt = kml.newpoint(name="BallonStyle", coords=[(18.429191, -33.987286)])
pnt.style.balloonstyle.text = 'These are trees and this text is blue with a green background.'
pnt.style.balloonstyle.bgcolor = simplekml.Color.lightgreen
pnt.style.balloonstyle.textcolor = simplekml.Color.rgb(0, 0, 255)
kml.save("BalloomStyle.kml")

bgcolor             气球的背景颜色,接受十六进制字符串。
displaymode 如何显示气球,接受来自simplekml.DisplayMode常量的字符串。
text 将出现在气球中的实际文本接受字符串。
textcolor 气球中的文本颜色,接受十六进制字符串。

  • LineStyle

import simplekml
kml = simplekml.Kml()
lin = kml.newlinestring(name="Pathway", description="A pathway in Kirstenbosch",
coords=[(18.43312,-33.98924), (18.43224,-33.98914),
(18.43144,-33.98911), (18.43095,-33.98904)])
lin.style.linestyle.color = simplekml.Color.red # 线颜色
lin.style.linestyle.width = 20 #线宽
kml.save("LineStyle.kml")

color表示颜色的十六进制字符串,接受字符串。
colormode如何使用颜色,来自simplekml.ColorMode常量的字符串。
gxlabelvisibility是否显示文本标签。
gxoutercolor线的外部颜色,接受字符串。
gxouterwidth线的外部宽度,接受浮动。
gxphysicalwidth线的物理宽度,接受浮动。
width线的宽度,接受浮动。

PolyStyle 多样式

import simplekml
kml = simplekml.Kml()
pol = kml.newpolygon(name="Atrium Garden",
outerboundaryis=[(18.43348,-33.98985),(18.43387,-33.99004),(18.43410,-33.98972),
(18.43371,-33.98952),(18.43348,-33.98985)],
innerboundaryis=[(18.43360,-33.98982),(18.43386,-33.98995),(18.43401,-33.98974),
(18.43376,-33.98962),(18.43360,-33.98982)])
pol.style.polystyle.color = simplekml.Color.red
pol.style.polystyle.outline = 0
kml.save("PolyStyle.kml")

color        ¶表示颜色的十六进制字符串,接受字符串。
colormode 如何使用颜色,来自simplekml.ColorMode常量的字符串。
fill 必须填充多边形,接受 0 或 1 的整数。
outline 多边形必须被勾勒出来,接受 0 或 1 的整数。

Styling

from simplekml import Kml

kml = Kml()
fol = kml.newfolder("A Folder") 创建一个文件夹,文件夹可用共同样式
pnt = fol.newpoint(name="Kirstenbosch", coords=[(18.432314,-33.988862)])
pnt.style.labelstyle.color = 'ff0000ff' # Red
kml.save("singlestyle.kml")


举报

相关推荐

0 条评论