Determining Midpoint Between 2 Coordinates

后端 未结 5 1436
深忆病人
深忆病人 2020-12-15 04:55

I am trying to determine the midpoint between two locations in an MKMapView. I am following the method outlined here (and here) and rewrote it in Objective-C,

5条回答
  •  情书的邮戳
    2020-12-15 05:09

    I think you are over thinking it a bit. Just do:

    float lon3 = ((lon1 + lon2) / 2)
    float lat3 = ((lat1 + lat2) / 2)
    

    lat3 and lon3 will be the center point.

提交回复
热议问题