views:

30

answers:

1

I would like to limit the accuracy of a call to GClientGeocoder.getLocations so that it only returns results with accuracy of say 0 to 3, that is from unknown to sub-region.

The idea is to find the rough area in which the user clicked.

+1  A: 

getLocations() returns a response which contains an array. Walk the array until you find a placemark with the desired level of detail. For example, assuming your callback from getLocations() has a response parameter, use the following code:

for (var i=0; i<response.Placemark.length; i++) {
  if (response.Placemark[i].AddressDetails.Accuracy < 4) {
    alert(response.Placemark[i].address);
    break;
  }
}
Mark