Cesium not respecting StyleMap in KML files

408 views
Skip to first unread message

Dylan Tusler

unread,
Nov 8, 2015, 3:35:17 AM11/8/15
to cesium-dev
I have KML files which use a <gx:track> for the track element, but also a number of <LineString> elements that highlight different segments of the track in different colors (top speeds etc.)

The KML renders fine in Google Earth, but the styling for the linestrings is not respected by Cesium.

Here's a sample of a 100m linestring. The <styleUrl> element specifies a style called #100mstyle

</Placemark><Placemark ID="100m"><styleUrl>#100mstyle</styleUrl><description>100m</description><name>26.668 2:41 AM UTC</name><visibility>1</visibility><LineString><tessellate>1</tessellate><altitudeMode>clampToGround</altitudeMode><gx:drawOrder>98</gx:drawOrder><coordinates>
153.2426479,-27.468194,0
153.2425403,-27.468277,0
153.2424395,-27.4683626,0
153.2422438,-27.4685363,0
153.2421404,-27.4686213,0
153.2420317,-27.4687026,0
</coordinates></LineString>

Earlier on in the file, the #100mstyle is defined thus:
<Style id="100mstyle_n">
  <LineStyle>
    <color>FFFFFF00</color>
    <width>2</width>
  </LineStyle>
</Style>
<Style id="100mstyle_h">
  <LineStyle>
    <color>FFFFFF00</color>
    <width>4</width>
  </LineStyle>
</Style>
<StyleMap id="100mstyle">
  <Pair>
    <key>normal</key>
    <styleUrl>100mstyle_n</styleUrl>
  </Pair>
  <Pair>
    <key>highlight</key>
    <styleUrl>100mstyle_h</styleUrl>
  </Pair>
</StyleMap>

What I'm expecting is that "normally" the normal style would be applied (100mstyle_n)

In a miracle scenario, Cesium might support hover and then when the mouse hovers over the relevant segment, the _h style is applied (which basically increases the width of the line.)

At the moment, all segments are rendered in white.

I don't have a whole lot of control over the KML. I could change it for future renders, but the current library of 100,000+ files is already in the format mentioned above. Is there anything wrong with the KML? Or is it just unsupported? And if it is unsupported, can anyone poitn me to the right bit of code so I can try and add support?

Cheers,

Dylan.

Dylan Tusler

unread,
Nov 8, 2015, 3:41:04 AM11/8/15
to cesium-dev
Just realised I posted on this topic once before, and at the time the response was that this was a known issue and would be fixed in 1.11

We are now running 1.14 and it doesn't seem to be fixed. Can anyone confirm?

Dylan

Dylan Tusler

unread,
Nov 8, 2015, 3:43:19 AM11/8/15
to cesium-dev


On Sunday, 8 November 2015 18:35:17 UTC+10, Dylan Tusler wrote:

Hannah Pinkos

unread,
Nov 8, 2015, 3:31:54 PM11/8/15
to cesium-dev
Hello Dylan,

Sorry, no one has had a chance to look at this yet.  I'm not sure how soon it will be until it's fixed.

Best,

Hannah

Dylan Tusler

unread,
Nov 8, 2015, 4:57:55 PM11/8/15
to cesium-dev
If someone could point me in the general direction of this bit of code I could take a look. It's quite a high priority for my users.

Cheers,

Dylan.

Hannah Pinkos

unread,
Nov 8, 2015, 5:44:15 PM11/8/15
to cesium-dev
That would be great!  If you are able to fix it, we would love the contribution back.
Can you post a comment on the github issue?  Tag @mramato in the comment and say you're interested in taking a look at it.  He'll be able to give you the information you need.

-Hannah
Reply all
Reply to author
Forward
0 new messages