This library contains the most used geodetic calculations both in spherical and rhumb way.
- Go to release page.
- Download the lates release of the package.
- Import it to your unity project.
A doxygen output for the documentation of the code is included and will be included at every release. So, head to the releases page and find the document in the downloads section of the related version.
From Coordinate
Coordinate _from = new Coordinate(52.205, 0.119);
To Coordinate
Coordinate _to = new Coordinate(48.857, 2.351);
double result = _from.HaversineDistance(_to);
double result = _from.CalculateBearing(_to);
double result = _from.CalculateSphericalLawOfCosines(_to);
Coordinate result = _from.CalculateMidPoint(_to);
double fraction = 0.88; // Fraction should be between zero and 1 (0-1)
Coordinate result = _from.CalculateIntermediatePointByFraction(_to,fraction);
Coordinate result = _from.CalculateDestinationPoint(distance, bearing);
Coordinate[] result = _from.GetNCoordinatesBetweenTwoCoordinates(_to, 50);
double result = _from.CalculateEquirectangularApproximation(_to);
Coordinate firstCoordinate = new Coordinate(51.8853, 0.2545); // somewhere in UK
double firstBearing = 108.55d;
Coordinate secondCoordinate = new Coordinate(49.0034, 2.5735); // somewhere in France
double secondBearing = 32.44d;
//act
Coordinate result = SphericalCalculations.CalculateIntersectionPoint(
firstCoordinate, firstBearing,
secondCoordinate, secondBearing);
All the unit tests coded using NUnit framework. Unit test coverage is %100 .
Transcoded from JavaScript originals by Chris Veness (C) 2005-2019 under the MIT License
.
All of the calculations used in this library can be found here.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.