Google Map KML Label Overlay Labels Press Return Button ZERO_RESULTS

Attaching a listener to a KML layer:

var layer = new google.maps.KmlLayer('http://sites.google.com/site/kmlprototypes/kmls/temp.kml?dc_=' + Math.random(), {suppressInfoWindows:true,preserveViewport:true}); layer.setMap(map); google.maps.event.addListener(layer, 'click', function (obj) { alert(obj.featureData.id); }); 

The KML file is valid (verified using api check), you can find it here . Each label in XML has an id attribute, for example:

 <Placemark id="46"> <Style> <IconStyle> <Icon> <href> <![CDATA[http://chart.apis.google.com/chart?chf=bg,s,EAF7FE02&chxt=y&chbh=a,4,4&chs=48x48&cht=bvg&chco=FF0000,0000FF&chds=20,9048.00,0,9048.00&chd=t:8149.00|9048.00]]> </href> </Icon> </IconStyle> </Style> <Point> <coordinates>30.49566650390625,50.721378326416016</coordinates> </Point> </Placemark> 

When you click on the label in the google map object, the correct identifier is returned, but sometimes about 50% of the time obj.featuredData.id is null ( ZERO_RESULTS status is in the status field). I tried different data sets (from 100 to 1000), but this does not help. In addition, I tried different settings for lat, lng.

+8
javascript google-maps-api-3 kml
source share
1 answer

You are likely to fall within the limits indicated on this page: https://developers.google.com/kml/documentation/mapsSupport?hl=en

A maximum of 1000 functions per file can be the ones that bother you.

0
source share

All Articles