开发者

What's the best way to evaluate the accuracy of GPS sensor data for a user's location?

开发者 https://www.devze.com 2022-12-16 22:33 出处:网络
i want to use the best Coordinate. but one thing is confusing me here i want to check that if new location accuracy is better then use new location otherwise use old location

i want to use the best Coordinate. but one thing is confusing me

here i want to check that if new location accuracy is better then use new location otherwise use old location

if (newLocation.horizontalAccuracy>oldLocation.horizontalAccuracy)
{
    self.bestEffortAtLocation=newLocation; // this mean new location is better accurate
}
else
{
    self.bestEffortAtLocation=oldLocation; // this mean old location is better accurate
}

i want to know that above check is correct or not?

i know this is a stupid question. but now at this time i am at surface level.

Please sugges开发者_开发问答t


That's not really a good idea. To see why, let's say we call the accuracy at time t A(t), and it will be given in units of meters. We'll imagine the following situation:

  • A(0) = m meters
  • A(t) = n > m meters
  • v(0) = k meters/sec, where k/t > m
  • zero acceleration on the interval [0, t]

That is:

  • At time zero, your accuracy is some value m meters.
  • At some later time t, your accuracy is a worse value n meters.
  • Your speed at time zero will carry you outside the boundaries of the radius of m after time t.
  • You have constant acceleration, so your velocity doesn't change.

Using your algorithm, you would decline to use the new GPS location when you're at time t because n is worse than m, even though the user couldn't possibly anywhere near the old location. Their speed has carried them past the radius of m. That's clearly not right.

Instead, here's a rudimentary algorithm to decide whether the new location is better or worse than the old one:

  • At periodic intervals of t seconds each, store a 3-tuple (L, v, A) containing the location L, velocity v, and accuracy A of the user.

  • At some time u you would like to know what the best guess for the user's location is.

  • Examine the location at time u - t. If Aold > Anew (remember, higher values of accuracy are worse if they're measured in meters), then use the new location since it's more accurate.

  • If Aold < Anew, things are a little different. If A/t exceeds 2v, the user is probably still inside the accuracy circle, so use the old L. But if not, then the user has traveled outside the bounds of the accuracy circle, so use the new L.


     horizontalAccuracy is the radius of uncertainty for the location, that is the more its value the less accurate your location is. So you should revert the comparison you use.
    I'd also suggest to introduce some threshold below which any new location is good.


CLLocation.horizontalAccuracy is defined as

horizontalAccuracy

The radius of uncertainty for the location, measured in meters. (read-only)

@property(readonly, NS_NONATOMIC_IPHONEONLY) CLLocationAccuracy horizontalAccuracy

Discussion

The coordinate’s latitude and longitude identify the center of the circle and this value indicates the radius of that circle. A negative value indicates that the coordinate’s latitude and longitude are invalid.

So by that definition, the "better" accuracy is the lower value of the two that is non-negative.


Just because the accuracy has gone down, does that really mean you want to ignore the reading? For example, say I'm driving my car and I go behind a few tall buildings through a busy city centre, if you're still comparing the HDOP as it's known then you're going to leave a marker right outside the city, until I get to the other end where the signal is the same or stronger than the original.

In fact, once you've found the very best position (in a nice open field not moving lets say), then the HDOP is going to increase and you'll never update from your old location...


No. The easiest fix is to increment the old accuracy A(0) by the likely travelled distance, v*t. Then check whether A(0) + v*t) < A(t) - if so, use the old position instead of the new.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号