有没有办法让KML文件中的弹出气泡变大?目前,我已经显示了相关信息。但它并不干净。如果所有的粗体项目都在左边,看起来会更整洁。有点困惑,因为如果我玩弄宽度,这是有意义的,什么都不会改变。有什么想法?要添加的建议?
#Define the Objects within the Plot Line Chart
def PlotLineChart(myKml, latList, lonList, heightList=[], name="", descriptionList="", color="", width=5):
"""
Plot Line Chart
"""
descriptionString = ''
for desc in descriptionList:
descriptionString += (desc + '\n')
print(descriptionString)
ls = myKml.newlinestring(
name=name,
description=descriptionString
)
coords = []
if len(heightList) == 0:
for (lat, lon) in zip(latList, lonList):
coords.append((lon, lat))
else:
for (lat, lon, height) in zip(latList, lonList, heightList):
coords.append((lon, lat, height))
ls.coords = coords
ls.extrude = 1
ls.altitudemode = simplekml.AltitudeMode.relativetoground
ls.style.linestyle.width = width
ls.style.linestyle.color = GetColorObject(color)
发布于 2021-07-27 00:25:07
看起来您正在尝试将信息气球的描述部分中的属性很好地格式化为列表(不一定只是将气球放大)。
一种简单的方法是在每一行后面添加一个HTML换行符(<br>
标记)。
您可能可以通过将desc + '\n'
替换为desc + '<br>'
来实现这一点,这将导致每个placemark的KML如下所示:
<Placemark>
<name>Charley</name>
<description><![CDATA[
<b>Storm Classification:</b> Hurricane<br>
<b>Start Date:</b> 08/09/2004<br>
<b>End Date:</b> 08/15/2004<br>
<b>Max Wind Speed:</b> 149 mph<br>
<b>Minnimum Pressure:</b> 941 mb
]]></description>
...
请注意,如果您将HTML标记放在描述中,最好将整个描述包装在CDATA标记中:
<description><![CDATA[ ...your content with <tags> here... ]]></description>
这应该会产生一个看起来像这样的气球:
有关构造KML气球内容的更多信息,请参阅抽象"Feature“元素的KML文档:https://developers.google.com/kml/documentation/kmlreference#feature,然后向下滚动到关于<description>
标记内容的较长部分。
https://stackoverflow.com/questions/68503154
复制相似问题