0

Is there a way make pop out bubbles in the KML Files larger? At the moment I have the information displayed. But it's not clean. It'd look cleaner if all the bold items were on the left. Kind of confused because if I play around with the width, which makes sense, Nothing changes. Thoughts? Suggestions to add?

#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

JRoth9125
  • 3
  • 3
  • What platform are you viewing the KML on? Google Earth Pro? Earth web/mobile? Google Maps? Other KML viewers? Most of them will respect basic sizing of the HTML content, and expand the balloon to fit. And if you can provide a sample of your KML, we might be able to suggest techniques & details more effectively. – Christiaan Adams Jul 23 '21 at 19:05
  • @ChristiaanAdams Using Google Earth Pro. 'PC' Above is an image of the project - Under the code – JRoth9125 Jul 23 '21 at 19:15

1 Answers1

0

Looks like you're trying to nicely format the attributes in the description part of your info balloons into a list (not necessarily just make the balloon larger).

One simple way to do this is to add an HTML line break (<br> tag) after each row.

You can probably do this by replacing the desc + '\n' with desc + '<br>', which should result in the KML for each placemark looking something like this:

<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>
...

Note that if you put HTML tags inside your description, it's best to wrap the whole description in a CDATA tag:

<description><![CDATA[  ...your content with <tags> here... ]]></description>

That should result in a balloon that looks like this:

enter image description here

For more info on constructing KML balloon content, see the KML documentation for the abstract "Feature" element here: https://developers.google.com/kml/documentation/kmlreference#feature and scroll down to the long section about the contents of the <description> tag.

Christiaan Adams
  • 1,257
  • 1
  • 7
  • 13