0
votes

I have an android app that gets the lat&long from the device and uses googles reverse geocoding api to give back an address. Everything was working fine for some time but now all of a sudden I get zero_results/

I replicate it in my browser the request is: https://maps.googleapis.com/maps/api/geocode/json?latlng=31.783783783783782,35.22879215957073&key=MY_KEY

but if I change it to: https://maps.googleapis.com/maps/api/geocode/json?latlng=31.78,35.22&key=MY_KEY

which is just shortening the lat&lng to 2 decimals it works, but say if I round it to 2 decimals: https://maps.googleapis.com/maps/api/geocode/json?latlng=31.78,35.23&key=MY_KEY

It doesnt work!!!

I cant rim it without rounding it, but now i am afraid in another case it wont work, I don't know what is going on with the API, everything was working fine before.

Any help solving this would be appreciated.

Thanks

3

3 Answers

2
votes

This is because Google gives no support for disputed areas (such as Kinmen County, West Bank, Crimea, etc.). ZERO_RESULTS is the intended behaviour.

You can see the problem in google public issue tracker at https://issuetracker.google.com/issues/35826813

2
votes

The bad news, your point is at the DMZ. As stated above: Google Reverse Geocoding won't work near the 1949 armistice lines (and not in what used to be Jordanian territories 1949-1967).

enter image description here

The not-so-bad news: There may be some kind of a workaround that's feasible for some: OpenStreetMap can also provide reverse geolocation. Your coordinate:

https://nominatim.openstreetmap.org/reverse?&format=jsonv2&lat=31.779975&lon=35.227901

Yields

{
  "place_id": 199263301,
  "licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
  "osm_type": "relation",
  "osm_id": 7880713,
  "lat": "31.7782568",
  "lon": "35.2315827592487",
  "place_rank": 30,
  "category": "historic",
  "type": "heritage",
  "importance": 0,
  "addresstype": "historic",
  "name": "Old City of Jerusalem and its Walls",
  "display_name": "Old City of Jerusalem and its Walls, HaOmer, Jewish Quarter, Old City, Jerusalem, Jerusalem District, no, Israel",
  "address": {
    "address29": "Old City of Jerusalem and its Walls",
    "footway": "HaOmer",
    "suburb": "Old City",
    "city": "Jerusalem",
    "state": "Jerusalem District",
    "postcode": "no",
    "country": "Israel",
    "country_code": "il"
  },
  "boundingbox": [
    "31.7728081",
    "31.7837416",
    "35.2257013",
    "35.2375582"
  ]
}

As you can see, they may be off by quite a few hundreds of meters. In this case (I was mean, choosing a case that augments the issue) it spells 15min diversion by foot, and no way by car.

Some may find it tolerable. For others it means sending someone to the wrong place.

On the other hand, as mentioned before, I did pick a nasty case. In most cases OSM are pretty much accurate to a few meters.

1
votes

I just want to add that on 1/29/2018 I also started experiencing random results from the API. My code has been working great for more for a year. Now I can send a request with a well-defined location (not reverse; I start with an address or intersection in search of coordinates and geopolitical info) and I get no results. I can send again- no results. And I can send again- and I GET RESULTS! Same exact query, with differing responses. I think the root cause for my