Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/esri/core/geometry/GeoDist.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static public void geodesic_distance_ngs(double a, double e2, double lam1,
/* top of the long-line loop (kind = 1) */

q_continue_looping = true;
while (q_continue_looping == true) {
while (q_continue_looping && it < 100) {
it = it + 1;

if (kind == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;

import java.lang.ref.*;

import com.esri.core.geometry.Envelope2D;
Expand Down Expand Up @@ -230,8 +229,8 @@ static double geodesicDistanceOnWGS84Impl(Point ptFrom, Point ptTo) {
double e2 = 0.0066943799901413165; // ellipticity for WGS_1984
double rpu = Math.PI / 180.0;
PeDouble answer = new PeDouble();
GeoDist.geodesic_distance_ngs(a, e2, ptFrom.getXY().x * rpu,
ptFrom.getXY().y * rpu, ptTo.getXY().x * rpu, ptTo.getXY().y
GeoDist.geodesic_distance_ngs(a, e2, ptFrom.getX() * rpu,
ptFrom.getY() * rpu, ptTo.getX() * rpu, ptTo.getY()
* rpu, answer, null, null);
return answer.val;
}
Expand Down
31 changes: 31 additions & 0 deletions src/test/java/com/esri/core/geometry/TestGeodetic.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,37 @@ public void testRotationInvariance() {
}
}

@Test
public void testDistanceFailure() {
{
Point p1 = new Point(-60.668485, -31.996013333333334);
Point p2 = new Point(119.13731666666666, 32.251583333333336);
double d = GeometryEngine.geodesicDistanceOnWGS84(p1, p2);
assertTrue(Math.abs(d - 19973410.50579736) < 1e-13 * 19973410.50579736);
}

{
Point p1 = new Point(121.27343833333333, 27.467438333333334);
Point p2 = new Point(-58.55804833333333, -27.035613333333334);
double d = GeometryEngine.geodesicDistanceOnWGS84(p1, p2);
assertTrue(Math.abs(d - 19954707.428360686) < 1e-13 * 19954707.428360686);
}

{
Point p1 = new Point(-53.329865, -36.08110166666667);
Point p2 = new Point(126.52895166666667, 35.97385);
double d = GeometryEngine.geodesicDistanceOnWGS84(p1, p2);
assertTrue(Math.abs(d - 19990586.700431127) < 1e-13 * 19990586.700431127);
}

{
Point p1 = new Point(-4.7181166667, 36.1160166667);
Point p2 = new Point(175.248925, -35.7606716667);
double d = GeometryEngine.geodesicDistanceOnWGS84(p1, p2);
assertTrue(Math.abs(d - 19964450.206594173) < 1e-12 * 19964450.206594173);
}
}

@Test
public void testLengthAccurateCR191313() {
/*
Expand Down