3
votes

I would like to use some nice icons I found on this page http://kml4earth.appspot.com/icons.html. I choose this icon http://maps.google.com/mapfiles/kml/pal3/icon22.png but when I use it in a kml file, and display this KML in Google maps (or Google Earth), it appears as a double green triangle.

And this happens with many of the icons on that page. What can I do ?

Here is a sample KML:

<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns = 'http://www.opengis.net/kml/2.2' >
<Document>
<Style id='scuola'>
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon22.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>L08940P06194</name>
<description><![CDATA[Point: L08940P06194 School<br>]]></description>
<styleUrl>#scuola</styleUrl>
<Point>
<coordinates>-72.3553467, 18.5366992, 0 </coordinates>
</Point>
</Placemark>
</Document>
</kml>

thanks David Remotti

1
I see the same thing (compare the icon rendered by geoxml3 with the one from KmlLayer): geocodezip.com/geoxml3_test/… - geocodezip
thx this way is perfect. But how can I implement it in my application ? I'm writing the kml from PHP ... - David Remotti

1 Answers

2
votes

Under the covers Google Earth/Google Maps is remapping certain icon URLs such http://maps.google.com/mapfiles/kml/pal3/icon22.png

If you choose the icons with the URL prefix: http://maps.google.com/mapfiles/kml/pal{2,3,4,5} then you will notice it being remapped to a "standard" icon with the URL prefix of http://maps.google.com/mapfiles/kml/shapes/.

This is an undocumented feature of Google Earth and Google Maps.

This "feature" is described in the notes section on the web site you mention in your question.

This particular mapping of icons is a little strange but most of the icon remapping seems somewhat reasonable:
global icon => mountain icon

Original URL: http://maps.google.com/mapfiles/kml/pal3/icon22.png
Mapped Icon: http://maps.google.com/mapfiles/kml/shapes/mountains.png

Here's another mapping that is more intuitive:

forest/park icon => park icon

Original URL: http://maps.google.com/mapfiles/kml/pal2/icon12.png
Mapped Icon: http://maps.google.com/mapfiles/kml/shapes/parks.png

You can either:

  1. Let Google Earth/Google Map remap the icon and live with it or
  2. Make a copy of the original icon (e.g., save in Google Drive, etc.) and use the new URL (as a custom icon) in your KML to display it as-is.