jackpine / biketag-ios

http://biketag.jackpine.me
1 stars 1 forks source link

surface distance to the user for missed guesses #61

Closed michaelkirk closed 9 years ago

michaelkirk commented 9 years ago

When I guess incorrectly Then I should see a hint telling me how far away I am.

"Nope. You're 2.3 miles away."

or...

"Close! You're a 100 yards away."

Note that there already is a "distance" field used to determine if someone is "close enough" to be at the right spot, but I never determined what units this "distance" metric is in - I'm just using some build in functionality of RGEO/postgis. I have verified that it is not a simple multiple of the haversine distance e.g. as computed here: http://www.movable-type.co.uk/scripts/latlong.html

We may need to address that as part of this story, but maybe not, so long as we can succesfully nudge people close enough to the right spot.

svevang commented 9 years ago

As I understand: It should be the length of the shortest path across the WGS84 spheroid, assuming that we are using geography columns and a wgs84 projection.

Each projection has its own black box distance calculation, for example see proj4 for an implementation of these various black boxes

On Jun 5, 2015, at 1:52 AM, Michael Kirk notifications@github.com wrote:

Given I've just guess And I was wrong Then I should see a hint telling me how far away I am.

"Nope. You're 2.3 miles away." "Close! You're a 100 yards away."

This is also a convenient time to mention that I'm not sure how the "distance" metric in RGEO/postgis is being computed. I have verified that it is not a multiple of the haversine distance computed here: http://www.movable-type.co.uk/scripts/latlong.html

That may have to be addressed here, or maybe not, so long as we can get people close enough to nudge them towards the right spot.

— Reply to this email directly or view it on GitHub.

michaelkirk commented 9 years ago

Thanks for the tip Sam. Your knowledge here is really helpful. I'll see what I can figure out.

michaelkirk commented 9 years ago

I chose to surface the distance vaguely, rather than specifically, e.g

    if self.distance == nil {
      return "I can't tell how far away you are."
    } else if self.distance < 0.002 {
      return "Shoot! You're super close."
    } else if self.distance < 0.005 {
      return "You're close though."
    } else if self.distance < 0.015 {
      return "You are like a mile away."
    } else if self.distance < 0.1 {
      return "You're in the wrong neighborhood."
    } else {
      return "I'm not even sure you're on the right contintent."
    }

So I've sidestepped the issue of it not being completely accurate for now. I don't think it's actually very relevant to game play right now to solve that issue.