Is GeoPy a wrapper of another implementation? Where can I find a Scala or Java equivalent solution to measure distances between two coordinates? Geotools does not work the way I want. For example, I have spotted a couple of cases in which the coordinates do not converge and return an error.
Asked
Active
Viewed 1,709 times
1
-
can you expand on why GeoTools doesn't do what you want? This is an easy and well known problem with an easy solution. e.g. https://gis.stackexchange.com/questions/132142/geotools-find-distance-in-meters-between-point-and-path-in-lat-lon https://stackoverflow.com/questions/24809534/shortest-distance-between-a-line-segment-and-a-point-in-wgs84-crs-using-geotools – Ian Turton Aug 11 '15 at 13:21
-
Hi @iant. I made another post in regards to the non-converge issue I am currently facing. Can you please have a look and let me know what you think? http://stackoverflow.com/questions/31964589/geotools-distance-calculation-fails-with-no-convergence-exception-for-several-la – user706838 Aug 12 '15 at 12:10
3 Answers
2
The GeographicLib-Java package (I wrote this) will do what you want. It does all sorts of geodesic calculations on an ellipsoid. The solution for the distance between two points always converges.

cffk
- 1,839
- 1
- 12
- 17
1
have also a look at Geocalc. I wrote it for one of my website
//Kew, London
Coordinate lat = new DegreeCoordinate(51.4843774);
Coordinate lng = new DegreeCoordinate(-0.2912044);
Point kew = new Point(lat, lng);
//Richmond, London
lat = new DegreeCoordinate(51.4613418);
lng = new DegreeCoordinate(-0.3035466);
Point richmond = new Point(lat, lng);
double distance = EarthCalc.getDistance(richmond, kew); //in meters
double distance = EarthCalc.getHarvesineDistance(richmond, kew); //in meters
double distance = EarthCalc.getVincentyDistance(richmond, kew); //in meters

Romain Gallet
- 21
- 1
0
In the past I've worked with JTS, it's a very rich library for processing georeferenced data. If you want to use it in Scala it's not very idiomatic but I know there's a binding library that may fit your needs.

stefanobaghino
- 11,253
- 4
- 35
- 63