Question

So I defined a Maps overlay with several placemarks to visualize research I'm doing. The descriptions have the results in them, and all works nicely. But when I open a balloon, the previously opened one closes, so that there's no real possibility to compare the results over the different placemarks.

I looked at the KML FAQ for this, and it says it's not possible to have a description open when the KML is opened.[1] It also says to use feature anchors to have another balloon open when a first one is opened.[2] But this would mean I have a fixed set of balloons to open at the same time, while I'd like the viewer to decide which ones are open at any given time.

So is it possible to keep them from closing when I open another balloon? If not, is there another possibility to display text info for several places at the same where the viewer can decide on which placemarks are open?

[1] https://developers.google.com/kml/faq#balloonopenfile

[2] https://developers.google.com/kml/documentation/kmlreference#featureanchor

Was it helpful?

Solution

Here's on option:

When you create the KMLLayer, set the suppressInfoWindows option to false. Then add an event that captures the click event: [https://developers.google.com/maps/documentation/javascript/reference#KmlMouseEvent][1]

That gives you access to the featureData, [https://developers.google.com/maps/documentation/javascript/reference#KmlFeatureData][2] which gives you access to the infoWindowHtml. With that, create your own InfoWindow at the latLng of the click. Create a new one for each click, so that they'll stay open.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top