On 28 December 2012 02:53, Hardik Shah <[email protected]> wrote: > > I read this article here which says that I can use the exact address as a > string for the setCenter() function. So here I have my code -
Which article where? The version 2 map.setCenter() function requires a GLatLng as its first parameter: https://developers.google.com/maps/documentation/javascript/v2/reference#GMap2.setCenter ...so it's not possible to pass an address. You have to geocode the address yourself and pass the location to setCenter(). It would be possible to write a function which does that, although geocoding is asynchronous and takes time [and server effort] so it won't be instantaneous. It's ALWAYS best to geocode known locations and use their coordinates. ONLY use the geocoder for locations which your users enter and you cannot know in advance. -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" 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.
