Vendea
Vendea

Reputation: 165

KML to Foreflight import - changing icons

I am working on a kml file of local hospitals to be imported into Foreflight as a user map layer. The points are formatted very simply:

       <Placemark>
            <name>OHSU</name>
            <description>Portland OR (9OR6)</description>
            <Point>
                <altitudeMode>clampToGround</altitudeMode>
                <coordinates>-122.6854629516602,45.49906158447266,0</coordinates>
            </Point>
        </Placemark>

Notice there's no styling - in google earth this shows up with the default yellow pin and the name showing. However, once imported into Foreflight it shows up as the default blue triangle pin with no name showing.

I want to keep it with no name showing, but change the color of the icon to red. So, I loaded a file with the red pushpin on a single point and then used that style link to change the placemark to red. Like so:

       <Placemark>
            <name>OHSU</name>
            <styleUrl>#redIcon</styleUrl>
            <description>Portland OR (9OR6)</description>
            <Point>
                <altitudeMode>clampToGround</altitudeMode>
                <coordinates>-122.6854629516602,45.49906158447266,0</coordinates>
            </Point>
        </Placemark>

where redIcon is defined above:

<Style id="randomColorIcon">
      <IconStyle>
         <color>"red"</color>
         <scale>1.1</scale>
         <Icon>
            <href>http://maps.google.com/mapfiles/kml/pushpin/red-pushpin.png</href>
         </Icon>
      </IconStyle>
   </Style>

but when I do that the description also shows up on the imported points.
I've also tried adding simply a <color>"red"</color> block to the placemark on the line after "name" but that doesn't change the color. Based on Foreflight's reaction I suspect that something about the original bare-bones method of defining the points is breaking something in Foreflight. (I think it intends to show the name always but without a style it won't). Unfortunately I can't find any resources about the Foreflight API and how it actually parses the kml data into it's own triangle placemarks, et c. I've looked for answers on aviation stack exchange as well - no one seems to have this particular problem.

Any thoughts are appreciated. I feel like changing just the icon color without also making the name show up should be simple enough that I'm just overthinking this and missing an easy solution.

UPDATE: testing with this short file of a single icon right now:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
   <Style id="redIcon">
      <IconStyle>
         <color>ff0000ff</color>
         <scale>1.0</scale>
         <Icon>
            <href>http://maps.google.com/mapfiles/kml/pal3/icon21.png</href>
         </Icon>
      </IconStyle>
      <LabelStyle>
         <color>00ff0000</color>
      </LabelStyle>
   </Style>
   <Placemark>
      <name>IconStyle.kml</name>
      <styleUrl>#redIcon</styleUrl>
      <description>Show me a point</description>
      <Point>
         <altitudeMode>clampToGround</altitudeMode>
         <coordinates>-122.36868,37.831145,0</coordinates>
      </Point>
   </Placemark>
</Document>
</kml>

I have tried changing virtually everything about LabelStyle, and based on foreflight's response, it appears that foreflight doesn't know how to parse LabelStyle separately from IconStyle. Changing the size, color, and opacity of the Label all had zero effect - it stayed the same color as the Icon. I can only conclude that this is a specific quirk of foreflight's API.

Upvotes: 0

Views: 610

Answers (2)

Stephane
Stephane

Reputation: 1

This answer probably comes way too late but I think you might be able to get rid of the labels by adding a scale block with a value of 0.0 in the labelStyle block after the color

Upvotes: 0

Vendea
Vendea

Reputation: 165

As of writing this (November 2019), I have confirmed with foreflight that LabelStyle is not supported. Supported elements are: - Point - LineString - LinearRing - Polygon - MultiGeometry - Style - StyleMap (only the "normal" style is supported) - LineStyle - PolyStyle - IconStyle

Hopefully this helps anyone else who might run into this problem.

Upvotes: 0

Related Questions