private Double getDistanceInKilometresForCorner(final GPS point, final GlobalPosition start) {
   final GlobalPosition endFirstCorner =
       new GlobalPosition(point.getDecimalLatitude(), point.getDecimalLongitude(), 0.0);
   final GeodeticMeasurement measurementForFirstCorner =
       geodeticCalculator.calculateGeodeticMeasurement(
           Ellipsoid.KRASSOWSKI, start, endFirstCorner);
   return Double.valueOf(measurementForFirstCorner.getPointToPointDistance() / METRES_IN_KM);
 }
예제 #2
0
  /**
   * *
   *
   * @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;
  }
예제 #3
0
  public static double distancia(RegistroGPS p, RegistroGPS q) {
    // instantiate the calculator
    GeodeticCalculator geoCalc = new GeodeticCalculator();

    // select a reference elllipsoid
    Ellipsoid reference = Ellipsoid.WGS84;

    // set origin coordinates
    GlobalCoordinates origin;
    origin = new GlobalCoordinates(p.getLatitud(), p.getLongitud());

    // set destination coordinates
    GlobalCoordinates destination;
    destination = new GlobalCoordinates(q.getLatitud(), q.getLongitud());

    // calculate the geodetic curve
    GeodeticCurve geoCurve = geoCalc.calculateGeodeticCurve(reference, origin, destination);
    return geoCurve.getEllipsoidalDistance();
  }