foursquare/twofishes

Decimal radius breaks reverse geocode

Closed this issue · 2 comments

When you use a radius with a decimal (for example http://demo.twofishes.net/?ll=40.74,-74.0&radius=1000.1) you hit a NumberFormatException. Maybe it's a bit of a hack, but would it make sense to change this line:
https://github.com/foursquare/twofishes/blob/master/server/src/main/scala/GeocodeServer.scala#L406

to something like:

.radius(getOpt("radius").map(_.toFloat.toInt))

Well, the radius is defined to be an integer both in thrift and in the api documentation at https://github.com/foursquare/twofishes/blob/master/docs/twofishes_requests.md:

radius=[radius in meters as an integer] -- defaults to 0 (point reverse geocode). If specified along with ll, will return all polygons touched by the circle defined by ll+radius. In strict geocoding mode, used for determining containment.

I would argue this is a legitimate failure, although I'm not really opposed to your suggestion.

Nah - I agree that this is working as designed and documented. Thanks!