mapbox / mapbox/mapbox-java

Turf distance measurement doesn't match TurfJS

未关闭
#1,167 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

question Turf
主要语言
Java
星标
438
派生
117
PR 合并指标
30 天内没有已合并 PR

描述

I am trying to port transformRotate from Turf.JS as I need it for a project.

In the method comments there are some examples with the expected result, my port didn't match. In trying to debug this I've noticed that the distance tests don't match between JS and the Java port.

The standard test points [-75.343,39.984][-75.534, 39.123] used the km distance in TurfJS is 97.12922118967835

Those same points are tested in the port but the expected result is different: 97.15957803131901

This third party suggests TurfJS is correct.

I've noticed Earth radius is different between the implementations so I guess this is the why

6371008.8

6378137

I see JS nearly changed to the same value for earth's radius but got reverted.

Is there a reason the port doesn't produce the same result as the original?

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 services-turf/src/main/java/com/mapbox/turf/TurfMeasurement.java 开始,将其距离计算与 TurfJS 进行比较,然后检查 services-turf/src/test/java/com/mapbox/turf/TurfMeasurementTest.java。确定这些实现产生不同值的原因,并更新实现或预期结果,使距离测试反映 TurfJS 的预期行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, javascript
领域
backend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。