Shakthi
Shakthi

Reputation: 175

Gives empty address when using google places api

I am trying to retrieve the exact address from the given lat/lng using the following url,

https://maps.googleapis.com/maps/api/place/search/json?&radius=1000&sensor=false&key=xxxxxxxxxxxxxx&location=13.24299231,80.30418218

The response JSON gives an array of results, the first object in the array has no address in the vicinity field. I would like to know if there is any other alternative for getting the address or is there any workaround to retrieve the exact address of the given lat/lng.

FYI - I prefer using Google Places API for address retrival.

Thanks in advance.

Upvotes: 1

Views: 1545

Answers (1)

Seain Malkin
Seain Malkin

Reputation: 2303

If the vicinity contains no data, then use the formatted_address or build the address by using the address_components array.

Here you will find a description of the response object returned.

Upvotes: 1

Related Questions