gpt4 book ai didi

Java - 新点,距纬度/经度点的 X 距离

转载 作者:行者123 更新时间:2023-11-30 04:44:34 25 4
gpt4 key购买 nike

我需要取一个点,并确定该点西北 N 英里和东南 N 英里处的点是什么。它本质上会在初始点周围创建一个边界框。

我环顾四周,发现了一些关于半正矢的东西,但似乎所有代码实现都是针对两点之间的距离,而不是来自一个点的新点分量。

是否有这样的东西的现有实现,最好是在 Java 中,已经存在?或者其他语言?

这是我想象的我需要的方法:

public float longitudeFromPoint( float lat, float long, int vertical, int horizontal )
{
// something
}

public float latitudeFromPoint( float lat, float long, int vertical, int horizontal )
{
// something
}

float startLat = 41.829347;
float startLong = -87.633788

float northWestLat = latitudeFromPoint( startLat, startLong, 1, -1 );
float northWestLong = latitudeFromPoint( startLat, startLong, 1, -1 );

float southWestLat = latitudeFromPoint( startLat, startLong, -1, 1 );
float southWestLong = latitudeFromPoint( startLat, startLong, -1, 1 );

最佳答案

这可能值得一读:Finding Points Within a Distance of a Latitude/Longitude Using Bounding Coordinates 。它给出了关于球坐标的简短理论背景并提供了一些 java 代码。

该链接借自此线程的已接受答案: Calculating bounding box a certain distance away from a lat/long coordinate in Java

关于Java - 新点,距纬度/经度点的 X 距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11369132/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com