GeoTools - 如何使用 GeoTools 类进行航位推算和路线计算

发布于 2024-09-27 19:22:20 字数 696 浏览 1 评论 0原文

我目前正在使用 GeoTools 工具包对船舶数据进行计算,例如计算两个经度/纬度点之间的大圆距离。我还有两个需要满足的要求,但我不确定在 GeoTools 中哪里可以找到进行此类计算的类。

要求#1: 计算移动船舶的航位推算位置。

输入值:

  • 当前经度
  • 当前纬度
  • 当前速度(可以很容易地转换为距离,给定时间“T”)
  • 当前航向

预期输出:

  • 时间“T”过去后估计的经度/纬度位置

要求#2: 计算从位置“A”到位置“B”的航向。

输入值:

  • 经度 'A'
  • 纬度 'A'
  • 经度 'B'
  • 纬度 'B'

预期输出:

  • 直接从 'A' 指向 'B' 的航线

问题

谁能指导我GeoTools 中的类能够执行这些计算吗? GeoTools 中的类数量之多让我不知所措,但我似乎找不到执行此操作所需的内容。

I'm currently using the GeoTools toolkit to do calculations on marine vessel data, such as calculating the Great Circle distance between two lon/lat points. I have two other requirements that I need to satisfy, but I'm not sure where to look in GeoTools to find classes to do these kind of calculations.

REQUIREMENT #1:
Calculate a Dead Reckoning position for a moving vessel.

INPUT VALUES:

  • current longitude
  • current latitude
  • current speed (which can be easily converted to a distance, given a time 'T')
  • current course

EXPECTED OUTPUTS:

  • estimated longitude/latitude position after time 'T' has elapsed

REQUIREMENT #2:
Calculate the course from position 'A' to position 'B'.

INPUT VALUES:

  • longitude 'A'
  • latitude 'A'
  • longitude 'B'
  • latitude 'B'

EXPECTED OUTPUTS:

  • course that points directly from 'A' to 'B'

QUESTION

Can anyone direct me to classes in GeoTools that are capable of performing these calculations? I'm overwhelmed by the sheer number of classes in GeoTools and I can't seem to find what I need to do this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

錯遇了你 2024-10-04 19:22:20

如何计算从位置“A”到位置“B”的航向

  • 需要位置“A”和“B”的经纬度
  • 获取GeodeticCalculator的实例class
  • 调用 setStartingGeographicPoint()
  • 调用 setDestinationGeographicPoint()
  • 调用 getAzimuth()
  • 将方位角转换为十进制

如何计算航位推算位置 ' X' 从位置“A”开始

  • 需要位置“A”的纬度/经度
  • 需要船舶当前的方位角航向
  • 需要以米为单位的行驶距离(或将其计算为速度* time)
  • 获取 GeodeticCalculator 类的实例
  • 调用 setStartingGeographicPoint()
  • 调用 setDirection()
  • 调用 getDestinationGeographicPoint()

以下是我需要自己实现的一些简单的单位转换方法。方位角有点混乱。方位角范围从-180 到+180,其值随着方向“角度”沿顺时针方向增大而增大。所以 -180 是南,-90 是西,0 是正北,+90 是东,+180 也是南。

public static final double KNOTS_PER_MPS = 1.9438444924406;
public static final double MPS_PER_KNOT = 0.514444444444444;


public static double metersPerSecondToKnots(double speedInMetersPerSecond) {
    return speedInMetersPerSecond * KNOTS_PER_MPS;
}

public static double knotsToMetersPerSecond(double speedInKnots) {
    return speedInKnots * MPS_PER_KNOT;
}

public static double courseInDegreesToAzimuth(double courseInDegrees) {
    Validate.isTrue(courseInDegrees >= 0.0 && courseInDegrees <= 360.0);
    double azimuth;
    if (courseInDegrees > 180.0) {
        azimuth = -180.0 + (courseInDegrees - 180.0);
    } else {
        azimuth = courseInDegrees;
    }
    return azimuth;
}

public static double azimuthToCourseInDegrees(double azimuth) {
    Validate.isTrue(azimuth >= -180.0 && azimuth <= 180.0);
    double courseInDegrees;
    if (azimuth < 0.0) {
        courseInDegrees = 360.0 + azimuth;
    } else {
        courseInDegrees = azimuth;
    }
    return courseInDegrees;
}

HOW TO CALCULATE COURSE FROM POSITION 'A' TO POSITION 'B'

  • Need to have the lat/lon of positions 'A' and 'B'
  • Get an instance of the GeodeticCalculator class
  • Call setStartingGeographicPoint()
  • Call setDestinationGeographicPoint()
  • Call getAzimuth()
  • Convert from azimuth to decimal degrees

HOW TO CALCULATE DEAD RECKONING POSITION 'X' STARTING FROM POSITION 'A'

  • Need to have the lat/lon of position 'A'
  • Need to have the current course of the vessel in azimuth
  • Need to have the distance to travel in meters (or calculate this as speed * time)
  • Get an instance of the GeodeticCalculator class
  • Call setStartingGeographicPoint()
  • Call setDirection()
  • Call getDestinationGeographicPoint()

Here are some simple units conversion methods that I needed to implement myself. The azimuth was a little confusing. The azimuth ranges from -180 to +180 with the values increasing as the direction "angle" increases in a clockwise direction. So -180 is south, -90 is west, 0 is true north, +90 is east and +180 is also south.

public static final double KNOTS_PER_MPS = 1.9438444924406;
public static final double MPS_PER_KNOT = 0.514444444444444;


public static double metersPerSecondToKnots(double speedInMetersPerSecond) {
    return speedInMetersPerSecond * KNOTS_PER_MPS;
}

public static double knotsToMetersPerSecond(double speedInKnots) {
    return speedInKnots * MPS_PER_KNOT;
}

public static double courseInDegreesToAzimuth(double courseInDegrees) {
    Validate.isTrue(courseInDegrees >= 0.0 && courseInDegrees <= 360.0);
    double azimuth;
    if (courseInDegrees > 180.0) {
        azimuth = -180.0 + (courseInDegrees - 180.0);
    } else {
        azimuth = courseInDegrees;
    }
    return azimuth;
}

public static double azimuthToCourseInDegrees(double azimuth) {
    Validate.isTrue(azimuth >= -180.0 && azimuth <= 180.0);
    double courseInDegrees;
    if (azimuth < 0.0) {
        courseInDegrees = 360.0 + azimuth;
    } else {
        courseInDegrees = azimuth;
    }
    return courseInDegrees;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文