djthoms
djthoms

Reputation: 3096

KML layer not loading on Google Maps

normally I don't post with a help plea but I'm seriously at a loss... I have a KML layer that I want to load on an embedded Google Map. It worked fine for a few months but about three weeks ago, the KML data vanished. Upon validating my KML file I found two insignificant errors:

line 6, column 9: Invalid value for scale: .5 [help]

    <scale>.5</scale>
     ^
line 774, column 26: XML parsing error: <unknown>:774:26: undefined entity [help]

    <name>Brabant Bar and Caf&Atilde;&copy;</name>

Any help is greatly appreciated. I have a codepen demo that has a link to the KML file, a working embedded google map using the V3 API, and a known working KML file from Google. Below is the JavaScript I am using to control the map and KML overlay:

var map;
var src = "http://kingsofthecraft.com/sandiego.kml"; // does not work
// var src ="http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml"; // known to work

function init() {
    map = new google.maps.Map(document.getElementById("map"), {
        center: new google.maps.LatLng(32.945048, -117.243135),
        zoom: 9,
        mapTypeId: google.maps.Map.ROADMAP
    });
    loadKmlLayer();
}

function loadKmlLayer() {
    var kmlLayer = new google.maps.KmlLayer(src, {
        suppressInfoWindows: false,
        preserveViewport: false,
        map: map
    });
}

google.maps.event.addDomListener(window, 'load', init);

Upvotes: 0

Views: 1908

Answers (1)

geocodezip
geocodezip

Reputation: 161334

you wrote:

I found two insignificant errors:

line 774, column 26: XML parsing error: :774:26: undefined entity [help]

<name>Brabant Bar and Caf&Atilde;&copy;</name>

XML parsing errors are major problems with XML. XML parsers fail on them. If you encode your entities correctly, it works.

 <Placemark id="placemark19147">
 <name>Brabant Bar and Caf&amp;Atilde;&amp;copy;</name>
 <styleUrl>#Beer Bar</styleUrl>
 <description><![CDATA[
<a href="http://beermapping.com/maps/reviews/reviews.php?locid=19147">Brabant Bar and Caf&amp;Atilde;&amp;copy;</a><br />
Beer Bar<br />
San Diego, CA 92104<br />
United States<br />
]]></description>

Upvotes: 1

Related Questions