|
When trying to calculate a new Geographic point based on a given one, an azimut and a distance using GeodeticCalculator, the results are only correct, when calculating a point on azimut +/-90 (north/south-axis). For all other directions, an error is introduced that increases while moving towards the east/west-axis. The attached image shows the results generated by GeodeticCalculator for points in steps by 5 degrees with a distance of 100000 meters (100km) around Zurich.
At first, I thought it is a projection problem, but changing the CRS did not change the wrong results. I have checked the results with the distance calculator of wolframalpha.
Exemplary wrong result (like in code below):
Startpoint Coordinates: 47.38,8.54
Azimut: 0 Distance: 100000
Endpoint Coordinates: 47.38,9.444147459825976
Distance between coordinates: ~68.28km, not 100.
GeodeticCalculator.getOrthodromicDistance() returns 100000.0 for the same coordinates.
Here some test code which returns a wrong coordinate (attached as well):
//Zurich, Switzerland coordinates
Point2D startPoint = new Point2D.Double(47.38, 8.54);
//Calculate a point 100 km to the east of Zurich
GeodeticCalculator calc = new GeodeticCalculator();
//GeodeticCalculator calc = new GeodeticCalculator(CRS.decode("EPSG:3785"));
//GeodeticCalculator calc = new GeodeticCalculator(CRS.decode("EPSG:4326"));
calc.setStartingGeographicPoint(startPoint);
calc.setDirection(0, 100000);
Point2D endPoint = calc.getDestinationGeographicPoint();
System.out.println("Startpoint Coordinates: " + startPoint.getX() + "," + startPoint.getY());
System.out.println("Endpoint Coordinates: " + endPoint.getX() + "," + endPoint.getY());
|