I am trying to create a page with a map that will center on an
address. The address can vary, and needs to be geocoded each time
because it is coming from a database that changes often. I cant quite
seem to get the script to do what I want, and I'm not that experienced
with Javascript. The variable address is set to "california" right now
but eventually the variable "address" will be constructed by pulling
URL parameters. But first I need to get the map to work by centering
on a geocoded address automatically when loading. Any help?

I've been trying different things but here's what I'm working with
right now:

    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        var geocoder = new GClientGeocoder();
        var address = "california"
        geocode.getLatLng(address, function(point) {
                 if (!point) {
                   alert("Unable to locate, check the address");
                 } else {
                   map.setCenter(point, 13);
                   var marker = new GMarker(point);
                   map.addOverlay(marker);
                 }
        });

      }
    }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to