1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Swift MkMapViewで地図アプリ作成してみた(20)- 受信精度の悪いGPSデータを間引く

Posted at

#記事一覧
Swift MkMapViewで地図アプリ作成してみた(記事一覧)

#受信精度の悪いGPSデータを間引く
###GPSの受信鮮度

あまり該当するケースは存在しないが、GPS鮮度がtimeInterval秒過ぎていた場合、読み捨てる。

    if timeInterval <= Int(abs(locations.last!.timestamp.timeIntervalSinceNow)) {
        return
    }

###水平誤差
水平誤差がaccuracyメートルを越えた場合、読み捨てる。

    if accuracy < Int(locations.last!.horizontalAccuracy) {
        return
    }

###緯度経度が無効
水平誤差が負の値の場合、緯度経度が無効なので読み捨てる。

    if 0 > locations.last!.horizontalAccuracy {
        return
    }
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?