开发者

Retrieving "inactive" infowindow HTML in Google Map

开发者 https://www.devze.com 2022-12-18 13:10 出处:网络
I\'m using Google Maps API v2 and Geoxml to produce a map which is retrieving content.It is nice and easy to get to the marker array in a Geoxml instance (instancevar.overlayman.markers) which contain

I'm using Google Maps API v2 and Geoxml to produce a map which is retrieving content. It is nice and easy to get to the marker array in a Geoxml instance (instancevar.overlayman.markers) which contains the properties and methods of the markers. What I can't tell is how to get to the string of HTML that appears when the click method on the marker is activated. I can use JavaScript to activate the method, and I know that the openWindowInfoHtml method is defined when processing the KML/GeoRSS with the appropriate information. Is 开发者_如何学Gothat information available somewhere in the runtime insances of the markers? Or, if not, where is it defined?


There is nothing in the API to get the html. Having a look at the Geoxml source it is just calling openInfoWindow from the click event (passing in the html at that point), so I don't think you can get it that way.

You could modify the Geoxml source to associate the html with the GMarker when it creates it, but this isn't going to be trival as there isn't a single spot in the library to do this.


I'm going to go against the SO directives to not answer your own question to answer @leoben's question.

You have to note that I'm not using Google's GGeoXml class, but a much better one with many more features that I linked to in my original question. If you use that one, the important thing to remember is that the overlayman.markers array isn't fully instantiated until your KML is parsed, something that happens asynchronously. You need to add a listener for the parsed event, which is triggered by GeoXml when it's finished.

You can see and example of this at http://www.ecu.edu/campusmaps which doesn't show the button controls until the parsed event is triggered.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号