經過經緯度計算兩點間多距離

+(CGFloat)getDistanceFrom:(CLLocationCoordinate2D)from To:(CLLocationCoordinate2D)tocss

{git

    double EARTH_RADIUS = 6371393;//地球半徑 單位米url


    CGFloat dis = sinf(from.latitude*M_PI/180)*sinf(to.latitude*M_PI/180)+cosf(from.latitude*M_PI/180)*cosf(to.latitude*M_PI/180)*cosf((from.longitude-to.longitude)*M_PI/180);spa

    dis = EARTH_RADIUS*acosf(dis);3d

    

    return dis;orm

}blog

相關文章
相關標籤/搜索