Sarge
Sarge

Reputation: 2366

Points in KML with custom icon suddenly not displaying in KMLLayer (but Linestrings do)

This code worked perfectly until a short time ago. The KML and the Javascript certainly haven't changed so I'm imagining I have some issue in the KML which a Google update now doesn't like.

I have a Google Maps API implementation which simply loads a KML file into a KMLLayer on a map. Now, I get the Linestrings displaying but not the points.

Here is the relevant snippets from the KML.

    <Style id="start">
        <IconStyle>
            <scale>0.0</scale>
            <heading>0.0</heading>
            <Icon>
                <href>http://d1b3rm3ifop01h.cloudfront.net/mapicons/start-race-2.png</href>
                <refreshInterval>0.0</refreshInterval>
                <viewRefreshTime>0.0</viewRefreshTime>
                <viewBoundScale>0.0</viewBoundScale>
            </Icon>
        </IconStyle>
    </Style>

    ...

    <Placemark>
        <name>Baden Powell Horseshoe Bay Trailhead</name>
        <description>Elevation: 54.9 m (180.2 ft)&lt;br /&gt;Very small carpark only accessible travelling north.&lt;br /&gt;&lt;a href=&quot;http://www.trailhunger.com/junction/820&quot;&gt;Junction Information&lt;/a&gt;</description>
        <styleUrl>#start</styleUrl>
        <Point>
            <coordinates>-123.2749314141,49.3669179082,54.93</coordinates>
        </Point>
    </Placemark>

Upvotes: 0

Views: 717

Answers (1)

Sarge
Sarge

Reputation: 2366

The problem was that the scale element was set to 0.0 and Google very recently changed their Google Maps KML parser to honour the scale element. Setting it to 1.0 made the icons appear.

0.0 is the default for the de.micromata.opengis.kml libary I'm using.

The next problem was that the icons were appearing in the wrong position. This was because I needed the hotSpot element to be specified.

This answer was provided by [email protected] on the Google Maps API issue I raised.

Upvotes: 1

Related Questions