2012-04-11 59 views
1

我需要在任何方向的当前位置最近的百米位置的纬度和长期价值,这里是我的代码,如何获得最近百米位置的纬度和长值到当前位置

CLLocationCoordinate2D annotationCenter; 
double ms = 100; 
double scalingFactor = ABS((cos(2 * M_PI * currentLocationCoordinates.latitude/360.0))); 
if ([misson.location.latitude doubleValue] == 0.0 && [mission.location.longitude doubleValue] == 0.0) { 
    annotationCenter.latitude = currentLocationCoordinates.latitude+(ms/103.5*1000); 
    annotationCenter.longitude = currentLocationCoordinates.longitude+(ms/(scalingFactor * (103.5*1000))); 
} 

我不知道天气是否正确,请帮助我。

+0

所以你想要在你当前位置周围半径为100米的圆的点?那你为什么要检查myLocation的纬度和任务的经度是否为0?你的意思是你想要一个从currentLocation到mission的线上100m的点吗? – Craig 2012-04-11 19:11:32

+0

在这里,我有我的当前位置,我需要找到在我目前位置朝任何方向100米附近的lat&Long值。 – Valli 2012-04-12 05:01:11

回答

0

看一看克里斯俯伏的文章:

http://www.movable-type.co.uk/scripts/latlong.html

您的问题似乎是计算“目标点一定距离,并从起始点轴承”。示例代码是所有的JavaScript,但它很简单,并且您应该没有问题将它移植到Objective-C。

相关问题