views:

60

answers:

1

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].

A: 

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
}
skarE
Why "location" property is not valid? Check http://code.google.com/intl/ru-RU/apis/maps/documentation/javascript/reference.html#GeocoderRequest - there is description of "location" property
SeniorDev