首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使KML文件中的弹出气泡更大

使KML文件中的弹出气泡更大
EN

Stack Overflow用户
提问于 2021-07-24 01:35:33
回答 1查看 24关注 0票数 0

有没有办法让KML文件中的弹出气泡变大?目前,我已经显示了相关信息。但它并不干净。如果所有的粗体项目都在左边,看起来会更整洁。有点困惑,因为如果我玩弄宽度,这是有意义的,什么都不会改变。有什么想法?要添加的建议?

代码语言:javascript
运行
复制
#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)

Pc

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-27 00:25:07

看起来您正在尝试将信息气球的描述部分中的属性很好地格式化为列表(不一定只是将气球放大)。

一种简单的方法是在每一行后面添加一个HTML换行符(<br>标记)。

您可能可以通过将desc + '\n'替换为desc + '<br>'来实现这一点,这将导致每个placemark的KML如下所示:

代码语言:javascript
运行
复制
<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标记中:

代码语言:javascript
运行
复制
<description><![CDATA[  ...your content with <tags> here... ]]></description>

这应该会产生一个看起来像这样的气球:

有关构造KML气球内容的更多信息,请参阅抽象"Feature“元素的KML文档:https://developers.google.com/kml/documentation/kmlreference#feature,然后向下滚动到关于<description>标记内容的较长部分。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68503154

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档