Reputation: 8609
I think this is one of those bugs where I "can't see the forest for trees". I've been working on this for days, and I can't seem to pinpoint the problem. It shouldn't be that hard; but I think I'm just too close to the code (or too unfamiliar with .kml) to see it.
I have this .kml file, which I posted below. I've eliminated most of it, so that it just displays a single address with the problem. (The file originally had "IconStyle" tags for a dozen or more squares with colors.)
My .kml file will pull up an address of a Walmart in Google Earth. The icon I want displayed is found at this URL (from the file): http://maps.google.com/mapfiles/kml/pal4/icon18.png (It's a square inside a green circle.)
But what displays instead, when I run the code below, is a red square! Careful eyes would be so appreciated! Thanks!
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1/">
<Document>
<name>test.kml</name>
<description>testIcon</description>
<LookAt>
<longitude>-111.5863733742289</longitude>
<latitude>39.55637809106051</latitude>
<altitude>0</altitude>
<range>610178.2115040587</range>
<tilt>-1.037184070538429e-013</tilt>
<heading>0.5510762374861048</heading>
</LookAt>
<StyleMap id="te">
<Pair>
<key>normal</key>
<styleUrl>#te1</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#te2</styleUrl>
</Pair>
</StyleMap>
<StyleMap id="fac">
<Pair>
<key>normal</key>
<styleUrl>#fac1</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#fac2</styleUrl>
</Pair>
</StyleMap>
<Style id="te1">
<IconStyle>
<color>ff87ff66</color>
<scale>0.8</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal4/icon56.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<scale>0</scale>
</LabelStyle>
</Style>
<Style id="te2">
<IconStyle>
<color>8887ff66</color>
<scale>1.2</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal4/icon56.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="fac1">
<IconStyle>
<scale>1.0</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal4/icon18.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<scale>0</scale>
</LabelStyle>
</Style>
<Style id="fac2">
<IconStyle>
<color>66ffffff</color>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal4/icon18.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>Walmart</name>
<address>1710 E Skyline Dr, South Ogden, UT 84405</address>
<styleUrl>#te</styleUrl>
<description><![CDATA[<div>Some Text</div>]]></description>
<styleUrl>#fac</styleUrl>
</Placemark>
</Document>
</kml>
Upvotes: 1
Views: 2664
Reputation: 23738
This is a known undocumented feature in Google Earth. The Google Maps icons with URL
http://maps.google.com/mapfiles/kml/pal*/icon**.png
are automatically redirected to one of the standard Google Earth icons. This is documented here (note 2).
So from your example, the icon:
is redirected to
with red fill color.
Source URL: http://maps.google.com/mapfiles/kml/pal4/icon18.png
And this URL:
gets remapped to:
Source URL: http://maps.google.com/mapfiles/kml/pal3/icon47.png
Likewise,
gets remapped to:
Source URL: http://maps.google.com/mapfiles/kml/pal2/icon4.png
If you choose an icon with a URL other than maps.google.com then it will display as-is so only workarounds are one of following: 1) choose one of the standard Google Earth icons (see help), 2) find icon from third-party web site (not maps.google.com/mapfiles/kml/pal**), or 3) copy the image at the external URL locally and refer to the local copy or copy it to a server.
Upvotes: 1