putting different colors into pushpins

6,571 views
Skip to first unread message

ErinH

unread,
May 31, 2011, 2:36:32 PM5/31/11
to KML Developer Support - Getting Started with KML
Dear KML people:

I would like to have different colors for my pushpins. I still like
the pushpins, but want to have different colors.

I have seen KML codes for different shapes, but not specifically for
color changes.

Any help would be much appreciated.

Sincerely,
Erin Hodgess

Eoghan

unread,
Jun 1, 2011, 6:46:05 AM6/1/11
to kml-support-g...@googlegroups.com
Hi,
I use different IconStyles for markers, the URLs for the icon images can be found in Google Earth by adding a new pin then clicking on the Pin button beside the name, example for a blue-pin below:

      <Style id="bluepin">
      <IconStyle>
        <Icon>
          <href>http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png</href>
        </Icon>
      </IconStyle>
    </Style>
      <Placemark>
          <styleUrl>#bluepin</styleUrl>
        <Point>
          <coordinates>0000000,0000000</coordinates>
        </Point>
      </Placemark>

Jason M

unread,
Jun 1, 2011, 1:09:45 PM6/1/11
to KML Developer Support - Getting Started with KML
Google provides 8 different colored pushpin icons as part of the
standard icon set.

http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png
http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png
http://maps.google.com/mapfiles/kml/pushpin/ltblu-pushpin.png
http://maps.google.com/mapfiles/kml/pushpin/pink-pushpin.png
http://maps.google.com/mapfiles/kml/pushpin/purple-pushpin.png
http://maps.google.com/mapfiles/kml/pushpin/red-pushpin.png
http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png
http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png

You can combine these icons with the color element to blend colors.

<Style id="orangeStyle">
<IconStyle>
<color>ff00aaff</color>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
</IconStyle>
</Style>

<Placemark>
<styleUrl>#orangeStyle</styleUrl>
<Point>
<coordinates>0,0</coordinates>
</Point>
</Placemark>

If you wanted many many colors and didn't care to explicitly define
the colors then you could use a single Style with random colorMode and
every placemark would have its own random color applied to the base
white color.

<Style id="randStyle">
<IconStyle>
<colorMode>random</colorMode>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png</
href>
</Icon>
</IconStyle>
</Style>

<Placemark>
<styleUrl>#randStyle</styleUrl>
<Point>
<coordinates>0,0</coordinates>
</Point>
</Placemark>
<Placemark>
<styleUrl>#randStyle</styleUrl>
<Point>
<coordinates>1,1</coordinates>
</Point>
</Placemark>
etc.

-jason
Reply all
Reply to author
Forward
0 new messages