My code: http://jsbin.com/epuxu
With help from SO, I managed to get addresses geocoded and their according pins placed on the map. The problem is that I can't select the coordinates in order to append a #message div to it on the map because I don't have the coordinates anymore.
I suspect I'm doing something wrong in this section:
/* Message
--------------------*/
$("#message").appendTo(map.getPane(G_MAP_FLOAT_SHADOW_PANE));
function displayPoint(marker, index){
$("#message").hide();
var moveEnd = GEvent.addListener(map, "moveend", function(){
var markerOffset = map.fromLatLngToDivPixel(marker.getLatLng());
$("#message")
.fadeIn()
.css({ top:markerOffset.y, left:markerOffset.x });
GEvent.removeListener(moveEnd);
});
map.panTo(marker.getLatLng());
}
it works when I use the original coordinate code (this is commented out on jsbin):
var markers = [
[39.729308,-121.854087],
[39.0,-121.0]
];
for (var i = 0; i < markers.length; i++) {
var point = new GLatLng(markers[i][0], markers[i][1]);
marker = new GMarker(point);
map.addOverlay(marker);
markers[i] = marker;
}
but I need help getting it to work with this current code:
function showAddress(markers) {
if (geocoder) {
geocoder.getLatLng(markers,
function(point) {
if (!point) {
alert(markers + " not found");
} else {
marker = new GMarker(point);
map.addOverlay(marker);
markers[i] = marker;
}
}
);
}
}
for (var i = 0; i < markers.length; i++) {
showAddress(markers[i]);
}
I'm kinda new to utilizing the google maps api, so any insight on what I'm doing wrong would be very helpful. Thanks =]