Back to project page noxdroidandroidapp.
The source code is released under:
MIT License
If you think the Android project noxdroidandroidapp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package dk.itu.noxdroid.util; /* w ww.j a va 2s.co m*/ import org.gavaghan.geodesy.Ellipsoid; import org.gavaghan.geodesy.GeodeticCalculator; import org.gavaghan.geodesy.GeodeticCurve; import org.gavaghan.geodesy.GlobalCoordinates; public class GPSUtil { // instantiate the calculator private static GeodeticCalculator geoCalc = new GeodeticCalculator(); // select a reference elllipsoid private static Ellipsoid reference = Ellipsoid.WGS84; /*** * * @param gc1 GPS coordinate * @param gc2 GPS coordinate * @return the distance between two gps coordinates */ public static double getGPSDelta(GlobalCoordinates gc1, GlobalCoordinates gc2) { if (geoCalc == null) { geoCalc = new GeodeticCalculator(); } GeodeticCurve geoCurve = geoCalc.calculateGeodeticCurve(reference, gc1, gc2); return geoCurve.getEllipsoidalDistance() / 1000000.0 ; } }