見出しの通り。
ふと毎度「馬鹿のひとつ覚え」でこうしてること自体に疑問が:
1 # ...
2 gps.configure(on_location=self.on_location,
3 on_status=self.on_status)
4 gps.start()
5
6 def on_location(self, **kwargs):
7 lon = float(kwargs['lon'])
8 lat = float(kwargs['lat'])
9 alt = float(kwargs['altitude'])
kwarg だよなぁ、実は「accurary」なんて取れてたりして:
1 now = datetime.now()
2 Logger.info(str(now) + ": " + ", ".join(["{}={}".format(k, kwargs[k]) for k in kwargs]))
はーん。bearing, speed, accuracy なんてのも取れておったのね。節穴だ。
kivy/plyer の場合は該当コードはこれ。ここの location は android SDK としてはこれ。
getAccuracy のドキュメント:
Get the estimated accuracy of this location, in meters.
We define accuracy as the radius of 68% confidence. In other words, if you draw a circle centered at this location’s latitude and longitude, and with a radius equal to the accuracy, then there is a 68% probability that the true location is inside the circle.
In statistical terms, it is assumed that location errors are random with a normal distribution, so the 68% confidence circle represents one standard deviation. Note that in practice, location errors do not always follow such a simple distribution.
This accuracy estimation is only concerned with horizontal accuracy, and does not indicate the accuracy of bearing, velocity or altitude if those are included in this Location.
If this location does not have an accuracy, then 0.0 is returned. All locations generated by the LocationManager include an accuracy.
うーん、これでとんでもない位置のデータを捨てるのはもっと楽に出来るかもしれない。試行錯誤はあるだろうけれど、この accuracy が 5000m だの 21000m だのだったら、迷わず捨てていいだろう。