View Full Version : Google maps

05-10-2009, 03:34 PM
I'm having a hard time getting this google maps script to work on my website.
It loads successfully and it shows up inside my div, but without any address markers.
Pretty much all of the script came from here (http://econym.googlepages.com/geomulti.htm). I removed and added only a couple of lines.
The goal is to have google geocode the "addresses" array and to display them on the map with markers.
Can anyone point out what's wrong?

var delay = 100;
var geo = new GClientGeocoder();

function getAddress(search, next) {
geo.getLocations(search, function (result) {
var p = result.Placemark[0].Point.coordinates;
var lat=p[1];
var lng=p[0];

var addresses = [

var nextAddress = 0;

function theNext() {
if (nextAddress < addresses.length) {
setTimeout('getAddress("'+addresses[nextAddress]+'",theNext)', delay);


function initialize() {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(0, 0), 1);

for (var i = 0; i < addresses.length; i++) {
var point = new GLatLng(lat[i], lng[i]);
map.addOverlay(new GMarker(point));