tags:

views:

159

answers:

3

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 that information available somewhere in the runtime insances of the markers? Or, if not, where is it defined?

+1  A: 

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.

Cannonade
A: 

How can you retrieve the overlayman.markers from the Ggeoxml variable? I tried to do that, but it didn't work to me.

this is my code

      geoxml = new GGeoXml("http://www.myurl.com/mykmlfile.kml");
      GEvent.addListener( geoxml, "load", function( ) {
        if ( geoxml.loadedCorrectly( )) {

          var markers = geoxml.overlayman.markers
          for (j=0; j<markers.length; j++) {
            alert(geoxmlvar.overlayman.markers[j])
          }
        }
      })
leoben
A: 

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.

Tony Miller