My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 3006: Trigger a "click" event on a KML Layer
57 people starred this issue and may be notified of changes. Back to list
Status:  NeatIdea
Owner:  [email protected]


Sign in to add a comment
 
Reported by [email protected], Jan 24, 2011
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]
To be effective, triggering a click event would also need the ability to pass a location (where the click occurred) - preferably by latLng. This would allow features in a KMLLayer to be selected from external controls or the ability to link to a page with a specific KML feature's info window already open.
May 20, 2011
#2 [email protected]
I agree this would be a good enhancement, an concur with Chad's assessment of passing a location in latlng.
May 20, 2011
#3 [email protected]
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
#4 [email protected]
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
#5 [email protected]
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
#6 [email protected]
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
#7 [email protected]
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
#8 [email protected]
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.
Jul 30, 2012
#9 [email protected]
(No comment was entered for this change.)
Jan 5, 2014
#10 [email protected]
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
#11 [email protected]
Please add this feature or provide a workaround.
Mar 2, 2015
Project Member #12 [email protected]
(No comment was entered for this change.)
Mar 2, 2015
Project Member #13 [email protected]
Thank you for suggesting this feature, and for listing your use cases. It's a good idea.
Status: NeatIdea
May 9, 2016
Project Member #14 [email protected]
(No comment was entered for this change.)
Sign in to add a comment

Powered by Google Project Hosting