在纬度/经度点之间计算纬度和经度?

时间:2022-12-31 16:02:39

Latitude: 22.744812, Longitude: 75.892578

纬度:22.744812,经度:75.892578

The above would be considered my center point.

以上将被视为我的中心点。

And now I need to determine the latitude and longitude points from center point 1000 meter outward to each NSWE corners. So I would have a central long/lat, N, S, E and W long/lat..

现在我需要确定从中心点1000米向外到每个NSWE角落的纬度和经度点。所以我会有一个中心长/纬,N,S,E和W长/纬..

So I would end up with 4 additional lat/long pairs.

所以我最终会增加4对纬度/长对。

What I am trying to resolve is a formula, preferably that can be done on a standard calculator to determine these 4 NSWE points based on the central point.

我想要解决的是一个公式,最好是可以在标准计算器上完成,以根据中心点确定这4个NSWE点。

3 个解决方案

#1


3  

You could use MapKit for that:

您可以使用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;
}

and just call

然后打电话

CLLocationCoordinate2D *fourPoints = [self calculateSquareCoordinates:center withRadius:1000];

on your code.

在你的代码上。

#2


0  

you will have to use the Haversine formula to calculate the Lat/Long based on distance from a starting Lat/Long. have a look at this Link

你将不得不使用Haversine公式来计算Lat / Long,它基于起始Lat / Long的距离。看看这个链接

#3


0  

The average radius of the earth is around 6371000 metres. This means that

地球的平均半径约为6371000米。这意味着

1 degree of lattitude is equivalent to 6371000 * PI / 180 metres

1度的等值相当于6371000 * PI / 180米

(NB: PI = 3.14159... etc). However, 1 degree of longitude depends on the lattitude that you are. At the equator, one degree of longitude corresponds to the same distance in metres as 1 degree of lattitude. However, at the north and south poles, all longitude values are the same point (i.e. the pole itself), so 1 degree of longitude at the poles is zero metres. The formula for longitude is

(注意:PI = 3.14159 ......等)。但是,1度经度取决于你的格度。在赤道,一度经度对应于以1度为单位的相同距离。但是,在北极和南极,所有经度值都是相同的点(即极本身),因此极点的1度经度为零米。经度的公式是

1 degree of longitude is equivalent to 637100 * PI / 180 * COS(Lattitude)

1度经度相当于637100 * PI / 180 * COS(Lattitude)

where COS is the trigonometric cosine function. If you make these conversions, then you can do the calculation on a standard calculator. However, be aware that these are approximations that work well over short distances (e.g. less than a few hundred kilometers), but over long distances (e.g. thousands of kilometers) they become more and more inaccurate.

其中COS是三角余弦函数。如果您进行这些转换,则可以在标准计算器上进行计算。但是,要注意这些近似值在短距离(例如,小于几百公里)内工作良好,但是在长距离(例如数千公里)上,它们变得越来越不准确。

#1


3  

You could use MapKit for that:

您可以使用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;
}

and just call

然后打电话

CLLocationCoordinate2D *fourPoints = [self calculateSquareCoordinates:center withRadius:1000];

on your code.

在你的代码上。

#2


0  

you will have to use the Haversine formula to calculate the Lat/Long based on distance from a starting Lat/Long. have a look at this Link

你将不得不使用Haversine公式来计算Lat / Long,它基于起始Lat / Long的距离。看看这个链接

#3


0  

The average radius of the earth is around 6371000 metres. This means that

地球的平均半径约为6371000米。这意味着

1 degree of lattitude is equivalent to 6371000 * PI / 180 metres

1度的等值相当于6371000 * PI / 180米

(NB: PI = 3.14159... etc). However, 1 degree of longitude depends on the lattitude that you are. At the equator, one degree of longitude corresponds to the same distance in metres as 1 degree of lattitude. However, at the north and south poles, all longitude values are the same point (i.e. the pole itself), so 1 degree of longitude at the poles is zero metres. The formula for longitude is

(注意:PI = 3.14159 ......等)。但是,1度经度取决于你的格度。在赤道,一度经度对应于以1度为单位的相同距离。但是,在北极和南极,所有经度值都是相同的点(即极本身),因此极点的1度经度为零米。经度的公式是

1 degree of longitude is equivalent to 637100 * PI / 180 * COS(Lattitude)

1度经度相当于637100 * PI / 180 * COS(Lattitude)

where COS is the trigonometric cosine function. If you make these conversions, then you can do the calculation on a standard calculator. However, be aware that these are approximations that work well over short distances (e.g. less than a few hundred kilometers), but over long distances (e.g. thousands of kilometers) they become more and more inaccurate.

其中COS是三角余弦函数。如果您进行这些转换,则可以在标准计算器上进行计算。但是,要注意这些近似值在短距离(例如,小于几百公里)内工作良好,但是在长距离(例如数千公里)上,它们变得越来越不准确。