使 KML 文件中的弹出气泡变大

Making Pop out Bubble in KML Files larger

有没有办法让 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)

Pc

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

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

您可以通过将 desc + '\n' 替换为 desc + '<br>' 来完成此操作,这应该会导致每个地标的 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> 标签内容的长部分。