barbushin
barbushin

Reputation: 5305

Google Maps API v3 Geocoder.geocode() argument "location" not works

There is "location" property in GeocoderRequest object, that defines "LatLng about which to search. Optional.", I'm trying to use it, but it does not work:

geocoder.geocode( { address: control.value, location: new google.maps.LatLng(59.938531, 30.313497)}, function(results, status) {....})

For example, when I'm searching for some address in 59.938531, 30.313497, so results contains 2 objects, and the right address has index [1] but not [0].

Upvotes: 1

Views: 13253

Answers (2)

skarE
skarE

Reputation: 5890

The location is not valid. You want either address or latLng. The GeocodeRequest object literal contains the following fields:

{
 address: string,
 latLng: LatLng,
 bounds: LatLngBounds,
 language: string,
 region: string
}

Upvotes: 1

Microbird
Microbird

Reputation: 11

Language parameter in JavaScript call by geocoder not supported:

http://code.google.com/intl/th-TH/apis/maps/documentation/javascript/reference.html#Geocoder

Upvotes: 1

Related Questions