user706838
user706838

Reputation: 5380

What is the equivalent of GeoPy for Scala or Java?

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.

Upvotes: 1

Views: 2044

Answers (3)

Romain Gallet
Romain Gallet

Reputation: 21

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

Upvotes: 1

cffk
cffk

Reputation: 1929

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.

Upvotes: 2

stefanobaghino
stefanobaghino

Reputation: 12804

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.

Upvotes: 0

Related Questions