Is it possible to define the map.setcenter to a zip code inside the
initialize function? Basically what I am wanting to do is I have an
input box on a different page that allows a user to input a zip code
then writes it to a database, and then when they click next it pulls
the data and takes them to the map page with it centered on the zip
code they have entered. I know i have to use the geocoding function
to change the zip to lat and lng and have the database end all
covered, but how can i make the map display this info on initialize
rather than in a different function.
This is the geocoding function i am using, is there a way to nest
this into the initialize function or is there a better way to do what
i am trying to do?
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
Thanks, Adam
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---