Iphone 在纬度/经度点之间计算更多的纬度和经度?
纬度:22.744812, 经度:75.892578 以上将被视为我的中心点 现在我需要确定从中心点1000米向外到每个NSWE角的纬度和经度点。所以我会有一个中心长/纬度,N,S,E和W长/纬度 因此,我将得到4个额外的lat/long对Iphone 在纬度/经度点之间计算更多的纬度和经度?,iphone,ios,objective-c,math,location,Iphone,Ios,Objective C,Math,Location,纬度:22.744812, 经度:75.892578 以上将被视为我的中心点 现在我需要确定从中心点1000米向外到每个NSWE角的纬度和经度点。所以我会有一个中心长/纬度,N,S,E和W长/纬度 因此,我将得到4个额外的lat/long对 我试图解决的是一个公式,最好是可以在标准计算器上完成,以根据中心点确定这4个NSWE点。您必须使用根据与起始Lat/Long的距离计算Lat/Long。看看这个您必须使用根据与起始纬度/长的距离来计算纬度/长。看看这个您可以使用MapKit来实现: - (C
我试图解决的是一个公式,最好是可以在标准计算器上完成,以根据中心点确定这4个NSWE点。您必须使用根据与起始Lat/Long的距离计算Lat/Long。看看这个您必须使用根据与起始纬度/长的距离来计算纬度/长。看看这个您可以使用MapKit来实现:
- (CLLocationCoordinate2D *) calculateSquareCoordinates:(CLLocation*)center withRadius:(float)radius{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(center.coordinate, radius*2, radius*2);
CLLocationCoordinate2D points[4];
points[0] = CLLocationCoordinate2DMake(region.center.latitude - region.span.latitudeDelta/2, region.center.longitude - region.span.longitudeDelta/2);
points[1] = CLLocationCoordinate2DMake(region.center.latitude + region.span.latitudeDelta/2, region.center.longitude - region.span.longitudeDelta/2);
points[2] = CLLocationCoordinate2DMake(region.center.latitude + region.span.latitudeDelta/2, region.center.longitude + region.span.longitudeDelta/2);
points[3] = CLLocationCoordinate2DMake(region.center.latitude - region.span.latitudeDelta/2, region.center.longitude + region.span.longitudeDelta/2);
return points;
}
打个电话就行了
CLLocationCoordinate2D *fourPoints = [self calculateSquareCoordinates:center withRadius:1000];
在您的代码上。您可以使用MapKit:
- (CLLocationCoordinate2D *) calculateSquareCoordinates:(CLLocation*)center withRadius:(float)radius{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(center.coordinate, radius*2, radius*2);
CLLocationCoordinate2D points[4];
points[0] = CLLocationCoordinate2DMake(region.center.latitude - region.span.latitudeDelta/2, region.center.longitude - region.span.longitudeDelta/2);
points[1] = CLLocationCoordinate2DMake(region.center.latitude + region.span.latitudeDelta/2, region.center.longitude - region.span.longitudeDelta/2);
points[2] = CLLocationCoordinate2DMake(region.center.latitude + region.span.latitudeDelta/2, region.center.longitude + region.span.longitudeDelta/2);
points[3] = CLLocationCoordinate2DMake(region.center.latitude - region.span.latitudeDelta/2, region.center.longitude + region.span.longitudeDelta/2);
return points;
}
打个电话就行了
CLLocationCoordinate2D *fourPoints = [self calculateSquareCoordinates:center withRadius:1000];
在你的代码中。地球的平均半径约为6371000米。这意味着 1度格度相当于6371000*PI/180米 (注:PI=3.14159…等)。然而,1度经度取决于你所处的纬度。在赤道,一个经度对应于一个纬度的距离,单位为米。但是,在北极和南极,所有经度值都是相同的点(即极点本身),因此极点的1度经度为0米。经度的公式是 1度经度相当于637100*PI/180*COS(格度)
其中COS是三角余弦函数。如果进行这些转换,则可以在标准计算器上进行计算。但是,请注意,这些近似值在短距离(例如不到几百公里)内适用,但在长距离(例如数千公里)内,它们变得越来越不准确。地球的平均半径约为6371000米。这意味着 1度格度相当于6371000*PI/180米 (注:PI=3.14159…等)。然而,1度经度取决于你所处的纬度。在赤道,一个经度对应于一个纬度的距离,单位为米。但是,在北极和南极,所有经度值都是相同的点(即极点本身),因此极点的1度经度为0米。经度的公式是 1度经度相当于637100*PI/180*COS(格度) 其中COS是三角余弦函数。如果进行这些转换,则可以在标准计算器上进行计算。但是,请注意,这些近似值在短距离内(例如,小于几百公里)效果良好,但在长距离(例如,数千公里)上,它们变得越来越不准确