Reverse Geocoding, when it's required and why?

4 posts / 0 new
Last post
tarouma
Reverse Geocoding, when it's required and why?

I ran into a routing problem today, we switched to sending lat/lng (which we get using themapquest service) to get directions.

A customer called with a route that was popping up a mapquest 602 error, can't compute route or can't calculate route.

So it takes a while but I narrow it down to having doreversegeocode set to false. We don't really need it, we have the address, and we have the lat/lng, so why geocode or reversegeocode?

But now I find that in some cases, for some reason mapquest can't find an address based on a geocode, even though the geocode for the address came from mapquest. Any ideas why this would be the case?

The fix was simple once I found out the reason for the fail, but it requires recalling the directions with doreservegeocoding set to true, so it's a double whammy for an app that is trying to be frugal. (an extra call PLUS reversegeocoding)

You can see for  yourself in POSTMAN

 

POST URL:

https://www.mapquestapi.com/directions/v2/route?key=YOURKEYHERE

x-www-form-urlencoded

key: json

value: {"locations":[{"latLng":{"lat":36.133717,"lng":-95.966080}},{"latLng":{"lat":36.102798,"lng":-95.869797}},{"latLng":{"lat":36.135365,"lng":-95.966187}}],"options":{"allToAll":false,"doReverseGeocode":false,"drivingStyle":2,"highwayEfficiency":7,"unit":"m","generalize":0}}

see the difference in results if you change doReverseGeocode to true.

So my question is just what is causing it to fail? mapquest has the address, mapquest has the lat/lng, what is the scenario where it can't match them without a reversegeocode?


MQBrianCoakley
Make sure to route using the
Make sure to route using the latLng rather than displayLatLng. This is snapped to the street and will route better. The displayLatLng has the potential to be on another street or, worse yet, an un-routable street.

tarouma
Okay, I'll make sure. We are

Okay, I'll make sure. We are getting ready to do a cleanup of all our addresses to try to make sure we have the correct latLng, so I'll doublecheck to make sure the script is pulling latLng and not displayLatLng


MQBrianCoakley
Let us know if you still run
Let us know if you still run into unroutable geocode results. These are very rare and can usually be fixed pretty quickly.