On Jul 21, 3:45 pm, Adam Kestel <[email protected]> wrote: > Is it possible to define the map.setcenter to a zip code inside the > initialize function?
Yes and no. > 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. The geocoder is asynchronous. You can call it in the initialize (which I assume is an onload function), but the results won't be available until the server sends them back and the call back function runs. I will admit this is a technicality, but you can't do anything useful to the map (like adding markers) until after is initialized by the first setCenter call). > > 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? Post a link if you want me to read or review code. -- Larry --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
