Reputation: 45
I have tried this http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true but getting so many addresses . Can I get particular address ?
Upvotes: 1
Views: 638
Reputation: 5144
From the doc:
Addresses are returned in the order of best to least matches. Generally, the more exact address is the most prominent result, as it is in this case. Note that we return different types of addresses, from the most specific street address to less specific political entities such as neighborhoods, cities, counties, states, etc. If you wish to match a more general address, you may wish to inspect the results[].types field.
Note: Reverse geocoding is not an exact science. The geocoder will attempt to find the closest addressable location within a certain tolerance.
In short, it looks like your best bet is to use the first result, as that will most likely be the one with the "best match" for the address you're looking for.
Upvotes: 0
Reputation: 700562
You always get all the areas that are relevant for that point, in the order of size.
Look at the types
property (last in each address). The first address has the type street_address
, then you get addresses for larger and larger areas until the last one that is country
.
Just pick one address that has the size that you are interested in, usually you want the first one that is the most specific one.
Upvotes: 0