Hello Charles Thanks for your email. Indeed, DistanceUtils has shortcomings. The Javadoc flags that class as needing changes [1] for this reasons. One possible action could be to replace it by GeodeticCalculator, a Geotk classes [2] that we considered to port to Apache SIS. That later class is based on the following Fortran code:
* ftp://ftp.ngs.noaa.gov/pub/pcsoft/for_inv.3d/source/forward.for * ftp://ftp.ngs.noaa.gov/pub/pcsoft/for_inv.3d/source/inverse.for However the GeographicLib project [3] may very well be a more advanced source, if we have your permission to port the relevant part of the code to Apache SIS in some future version. For now, I have filled a JIRA task listing the problems that you raised: https://issues.apache.org/jira/browse/SIS-385 Alternatively, we could create a binding to GeographicLib in a way similar to what we did for Proj.4. It could be done more easily for the coordinate operations parts (map projections and height transformations). But if the code is not too large and if we get your permission, port to Apache may be more convenient to SIS users. Another GeographicLib aspects that interest me are test data, but it would be the subject of another thread. Regards, Martin [1] http://sis.apache.org/apidocs/org/apache/sis/distance/DistanceUtils.html [2] http://www.geotoolkit.org/apidocs/org/geotoolkit/referencing/GeodeticCalculator.html [3] https://geographiclib.sourceforge.io/ Le 14/01/2018 à 22:37, Charles Karney a écrit : > The file > > core/sis-referencing/src/main/java/org/apache/sis/distance/DistanceUtils.java > > contains a routine getPointOnGreatCircle which includes an expression > for lat2 involving an arcsine. This is inaccurate if lat2 is near a > pole. Better to use the formula for tan(lat2) given in Note 5 of the > Wikipedia article > > https://en.wikipedia.org/wiki/Great-circle_navigation > > It also contains a routine getHaversineDistance. This is misnamed; it > should be called getGreatCircleDistance. (The so-called Haversine > method is a particular, not very good, formula for the distance. It > isn't being used in this routine.) > > The formula used by getHaversineDistance (or getGreatCircleDistance) > involves an arccosine. This is inaccurate for short distanaces. Better > to use the tangent formula given in Note 2 of the same Wikipedia > article. > > --Charles
