Sunday, January 23, 2011

[Google Maps API v2] Re: Two MarkerClusterer Questions (custom icons and GEvent.addListener())

if anyone else has ideas related to how to
> call that information from a data.json file on a "click," I would be
> grateful.  Thanks!  - Derek

if anyone else has ideas related to how
> call that information from a data.json file on a "click," I would be
> grateful.

I guess the first thing to do would be to get the infowindow to
actually appear, then go about the process of figuring out how to pass
your info to it. I assume you've tried plonking
"map.openInfoWindowHtml();" into the obvious places...?

(I'd be surprised if you need to put that into the clusterer file...
you should look more into Mike's examples... where you have:
var markers = [];
for (var i = 0; i < 311; ++i) {
var latlng = new GLatLng(data.client[i].lat,
data.client[i].long);
var marker = new GMarker(latlng, {icon: icon});
markers.push(marker);
}


he has:
var gmarkers = [];

// A function to create the marker and set up the event window
function createMarker(point,name,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});

...

for (var i = 0; i < markers.length; i++) {
// obtain the attribues of each marker
var lat = parseFloat(markers[i].getAttribute("lat"));
var lng = parseFloat(markers[i].getAttribute("lng"));
var point = new GLatLng(lat,lng);
var html = markers[i].getAttribute("html");
var label = markers[i].getAttribute("label");
// create the marker
var marker = createMarker(point,label,html);
map.addOverlay(marker);
}

in example 3... surely trying some of that in your main code (and
leaving the clusterer alone for the moment) should be your first step?

--
You received this message because you are subscribed to the Google Groups "Google Maps API V2" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate