LoginSignup
61
61

More than 5 years have passed since last update.

iOS/swiftで緯度・経度から2点間の距離を算出する

Posted at
let 現在地の緯度: Double = 135.5258549
let 現在地の経度: Double = 34.6873527
let 行き先の緯度: Double = 139.75313186645508
let 行き先の経度: Double = 35.68525668970075
let 現在地の位置情報: CLLocation = CLLocation(latitude: 現在地の緯度, longitude: 現在地の経度)
let 行き先の位置情報: CLLocation = CLLocation(latitude: 行き先の緯度, longitude: 行き先の経度)
距離 = 行き先の位置情報.distanceFromLocation(現在地の位置情報)

参考にさせていただきました
Objective-Cで経緯・緯度から2点間の距離を出す

61
61
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
61
61