Pat
Pat

Reputation: 155

google reverse geocode lookup find the nearest to latitude and longitude

Sometimes in rural areas and near national parks, geocode(location:"47.826424436, -124.2662817624318") returns only a single formatted_address:"84VQRPGM+HF".

Is there a way to force geocode to return the nearest county,town,or city? I don't know whether bounding box would help and even how to create one.

Can anyone point me in the right direction?

Upvotes: 1

Views: 75

Answers (1)

miguev
miguev

Reputation: 4840

Reverse geocoding (address lookup) request and response in the Google Geocoding API does not return a single result with formatted_address: "84VQRPGM+HF" (and types:["plus_code"]). This API returns an array of results which will typically include the city/town (usually locality), the postal code, the county (administrative_area_level_2) and other political entities that contain the provided latlng.

For 47.826424436,-124.2662817624318 you can see all results in https://developers.google.com/maps/documentation/utils/geocoder/#q%3D47.826424%252C-124.266282

Note that postal codes and political entities are returned only if they contain the provided point, e.g. 47.826424436,-124.2662817624318 being in a rural area, is not contained by any city, while e.g. 47.561341,-122.635421 is contained by the locality of Bremerton.

Upvotes: 0

Related Questions