Placemark styles

63 views
Skip to first unread message

robh...@usa.net

unread,
May 4, 2009, 10:39:48 AM5/4/09
to KML Developer Support - Getting Started with KML
I have a bunch of placemarks in a kml file. I have a <Style> at the
top that they all use. I want to have a different <heading> for each
placemark. <heading> is normally found in the style. So, does that
mean I need to have a different style for each placemark?

Nymor

unread,
May 6, 2009, 8:17:32 PM5/6/09
to KML Developer Support - Getting Started with KML
No - but you would have to specify the heading you want in each
placemark.

If you use the same styleurl for each placemark you can override any
of the settings at the placemark level. So you could use the same icon
behaviour but different colours say - or in you case different
headings.

So let's say you have a style (or stylemap) defined that included
various stuff including specifying an icon - you could then have 2
placemarks who both reference that style but the second of which turns
the icon by 90degs....

<Placemark>
<name>PM1</name>
<styleUrl>#mystyle</styleUrl>
<Point><coordinates>0,0,0</coordinates></Point>
</Placemark>

<Placemark>
<name>PM2</name>
<styleUrl>#mystyle</styleUrl>
<Style>
<IconStyle>
<heading>90</heading>
</IconStyle>
</Style>
<Point><coordinates>0,0,0</coordinates></Point>
</Placemark>

Just tested that and it seemed to work - but hopefully someone will
shout if that's not the correct way of doing it.

Hope that helps

Regards
Nymor

Nymor

unread,
May 6, 2009, 8:52:44 PM5/6/09
to KML Developer Support - Getting Started with KML
ps - A note of caution..

While the above seems to work - and I know I've done a similar thing
with an icons colour - I've just tried it with the Icon href and that
doesn't seem to work the same way.

Either I'm doing something wrong there myself or the over-riding only
works for some parts the style. Anyone know?

robh...@usa.net

unread,
May 11, 2009, 11:00:20 PM5/11/09
to KML Developer Support - Getting Started with KML
It worked, thanks. I was all set to post my kml that didn't work, but
I found the problem <Style></Style> not <style></style>. Is there a
capitalization standard I'm missing here?
Reply all
Reply to author
Forward
0 new messages