Question

I know that this have been previously discussed here but it seems like there is no hard and fast rule to fix it.

I am trying to get the lat long values of an address from the Geocoding API but it doesn't seem to work. For some addresses the lat long value is very precise but for some other addresses it is just giving me the lat long of address's city.

I have gone through Google Maps and a result shows up for the address. But when I input it from the query, it return just the lat long of city.

Example 1:

http://maps.googleapis.com/maps/api/geocode/json?address=jordan gate towers&sensor=false 

For this query the lat long are precise and the formatted_address is also the location's name

Example 2:

http://maps.googleapis.com/maps/api/geocode/json?address=Taj mall amman jordan&sensor=false

But for this the lat long and formatted_address is just the city.

Can some one shed some light and possibly tell any solution for this?

Was it helpful?

Solution

In the second example you try to geocode the address of a mall. That's not possible with the Geocoding API, because Google is treating a mall as a place. Therefore it's only available through the Google Places API. This is the same for POIs like restaurants, where you will not get any good result, if any, with Directions.

Maps is using both Directions and Places by default.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top