Instead of a marker for each, why not put the people at the same location in the same infowindow? One location, one infoWindow (containing multiple entries for people).
On Nov 19, 3:58 pm, Jeremy Blaney <[email protected]> wrote: > Hi all, > > On my website I have a map that pinpoints each user's approximate > location. I base it off a value called $location which is just a > combination of $city, $state, and $country. I don't want to get more > specific than that because I don't want too much information out there > publicly. > > Question is, I have SEVERAL markers that have the exactly same lat/ > lng. For example, a lot of my users are stationed at Vance AFB, OK > (lat="36.343071" lng="-97.907806"). > > I've read into marker clusters, but I'd rather not use something like > that. I like the idea of having TONS of markers in a small space... > only clickable when you get down to a basic level (clicking opens up > an info window with user's data). > > Is there a way to offset that lat/lng by just a bit? Or does anyone > have any suggestions? Am I stupid for not wanting to use marker > clusterers? > > Thanks for your help!!! > > In case you're curious, here's my code.... (Also having an issue with > the info window... the very last line of text is smushed against the > bottom boundary of the info window... on the info window... make > sense?.... but that's not hte reason I'm here). > > function load() { > if (GBrowserIsCompatible()) { > var map = new GMap2(document.getElementById("map")); > map.addControl(new GSmallMapControl()); > map.addControl(new GMapTypeControl()); > map.setCenter(new GLatLng(47.614495, -122.341861), 2); > map.enableScrollWheelZoom(); > > GDownloadUrl("world_xml.php", function(data) { > var xml = GXml.parse(data); > var markers = xml.documentElement.getElementsByTagName("marker"); > for (var i = 0; i < markers.length; i++) { > var first_name = markers[i].getAttribute("first_name"); > var last_name = markers[i].getAttribute("last_name"); > var email = markers[i].getAttribute("email"); > var affiliation = markers[i].getAttribute("affiliation"); > var status = markers[i].getAttribute("status"); > var service = markers[i].getAttribute("service"); > var rank = markers[i].getAttribute("rank"); > var specialty = markers[i].getAttribute("specialty"); > var city = markers[i].getAttribute("city"); > var state = markers[i].getAttribute("state"); > var country = markers[i].getAttribute("country"); > var point = new > GLatLng(parseFloat(markers[i].getAttribute("lat")), > > parseFloat(markers[i].getAttribute("lng"))); > var marker = createMarker(point, rank, first_name, last_name, > email, > affiliation, status, service, specialty, city, state, country); > map.addOverlay(marker); > } > }); > } > > } > > function createMarker(point, rank, first_name, last_name, email, > affiliation, status, service, specialty, city, state, country) { > var marker = new GMarker(point); > var html = "<b>" + rank + " " + first_name + " " + last_name + "</b> > <br/>" + service + ", " + status + "</b> <br/>" + specialty + "</b> > <br/>" + affiliation + "</b> <br/>" + city + ", " + state + " " + > country + "</b> <br/>" + email + "</b> <br/>" + " "; > GEvent.addListener(marker, 'click', function() { > marker.openInfoWindowHtml(html); > }); > return marker; > > } > > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
