| Issue 3006: | Trigger a "click" event on a KML Layer | |
| 57 people starred this issue and may be notified of changes. | Back to list |
Being able to trigger an event on a KMLLayer object just as you can do with a Marker object would be great !
var myKML = new google.maps.KmlLayer('www.test.com/test.kml');
var link1 = document.getElementById('aLink');
link1.onclick = function() {
new google.maps.event.trigger(myKML, 'click');
}
Mar 22, 2011
#1
[email protected]
May 20, 2011
I agree this would be a good enhancement, an concur with Chad's assessment of passing a location in latlng.
May 20, 2011
Actually after having thought about this for a while, the KML feature id would be a much better/more accurate identifier from which to trigger the event.
May 21, 2011
I would suggest that it passes the latLng as well as the KML feature id, as this would have been useful in my implementation.
Sep 29, 2011
I prefer the suggestion that the click passes the KLM feature id. That way it's simple. The KLM data includes latLng so is easily derived from the given id.
Sep 29, 2011
I think it all depends on how you intend to use this kind of event. For me, I would know the lat/long, and then I want to pass that lat/long to the KML so that the appropriate feature gets "clicked". I might not know the KML's feature id. Take this mashup: http://gis.mda.state.mn.us/animord/ Imagine that, after typing in a city or zip to get an address match, that the KML overlay is then automatically "clicked" to reveal the pertinent animal ordinance. Right now the user can zoom, but then THEY have to click in the map to reveal the ordinance.
Feb 23, 2012
I'd love to see this, and the kml feature id being passed in option preferably. In the case of the getting a lat/lng from an address lookup and then clicking there, the odds a zip / postcode matching the pixel of a kml seems small to me, so i'd rather see that as another api call, featureIdFromPoint(LatLng) that could then be passed into the event trigger.
Feb 23, 2012
Matt, you have to look at my mashup use case to understand my scenario. The KML overlay in my map is a continuous coverage of polygons (not a set of discrete points or small polygons). So the "odds" of a lat lng from zip/post falling inside one of my KML features are actually pretty good. Having said that, I understand needs for triggering a KML click both based on the feature ID or a lat/lng. If I understand your suggestion about the api call correctly, that sounds like a good method too.
Jan 5, 2014
I am creating a ground snow load map with kml data from the ASCE 7-10. My map/mashup is here: http://design.medeek.com/resources/snow/groundsnowloads.html I would like to trigger a click or somehow extract the kml description attribute after using the geocode feature. Currently this is missing and user is required to click to display this information, basically rendering my interactive map as broken.
Jan 5, 2014
Please add this feature or provide a workaround.
Mar 2, 2015
Thank you for suggesting this feature, and for listing your use cases. It's a good idea.
Status:
NeatIdea
|
|
| ► Sign in to add a comment |