On Dec 27, 9:53 pm, Hardik Shah <hds6...@g.rit.edu> wrote:
> I read this article here

Where is that article?

> which says that I can use the exact address as a
> string for the setCenter() function. So here I have my code -
>
> var search_location = "City+Hall,New+York,NY";
> //var searchLocation_LatLng = new GLatLng(37.7916,-122.4418);
>
> function load()
> {
>         map = new GMap2(document.getElementById("map"));
>         GEvent.addListener(map, "load", function() {updateMap();});
>         map.setCenter(search_location, 13);
>         .....................
>         ...................
>
> }.
>
> The above code does not work if using the 'search_location' variable. It
> gives the error - a.lng is not a function in main.js file! But the code
> works if I use the 'searchLocation_LatLng' variable.
>
> Can you please help. I need to be able to use the address directly if
> possible in setCenter() function.

1. The Google Maps API v2 is deprecated and will no longer be
supported after May 19, 2013; new development using this API is not
recommended, you should be using the Google Maps API v3:
documentation:
https://developers.google.com/maps/documentation/javascript/tutorial
Google Maps API v3 group:
https://groups.google.com/group/google-maps-js-api-v3
Technical Support is now at Stack Overflow:
http://www.google.com/url?sa=D&q=http://stackoverflow.com/questions/tagged/google-maps-api-3

2. In all versions of the Google Maps API (v1-3) the setCenter method
requires coordinates (latitude and longitude).  All versions of the
API also include geocoding functionality (to convert postal addresses
to coordinates).  You need to use the Geocoder if all you have is the
address.

  -- Larry

-- 
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 google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to