0

At the moment I am using the click event to display an info window above placeholders in a googlemap KML layer

google.maps.event.addListener(kmlLayer, 'click', function(kmlEvent) {
showInContentWindow(kmlEvent.latLng, kmlEvent.featureData.description);
});

What I would like to do is be able to permanently display the placeholder ID or Name (or other identifying info) above each placeholder without clicking. I've looked at the FAQ and can see that you can't have a description open when the map opens: https://developers.google.com/kml/faq#balloonopenfile

I am wondering if there is a way around it, or if it is possible to trigger it with onFocus or another listener instead of click?

I have no control of the KML file, so it has to be done via the page

4

1 回答 1

1

KmlLayer doesn't give you access to that data, except on a click.

One option would be to use a third party KML parser (like geoxml3 or geoxml-v3).

Here is an example using geoxml3 that displays information from the KML file on mouseover

于 2013-10-14T16:03:16.257 回答