geohash-java
geohash-java copied to clipboard
`VincentyGeodesy.distanceInMeters` works incorrectly if one of the points is either South or North pole
Example (all results in meters are converted into kilometers for convenience):
VincentyGeodesy.distanceInMeters(new WGS84Point(90, 0), new WGS84Point(89, 0)) / 1000.0
results to 19892.237593638412
whereas
VincentyGeodesy.distanceInMeters(new WGS84Point(-90, 0), new WGS84Point(89, 0)) / 1000.0
results to 111.69386491426172
which is apparently incorrect.
Note that for a point that is off the pole just a fraction of a degree, the algorithm seems working correctly (or at least plausible):
VincentyGeodesy.distanceInMeters(new WGS84Point(89.9999, 0), new WGS84Point(89, 0)) / 1000.0
results to 111.6826955163081
VincentyGeodesy.distanceInMeters(new WGS84Point(-89.9999, 0), new WGS84Point(89, 0)) / 1000.0
results to 19892.22642424046