public static double getDistance(LineString tripGeometry) {
      double distance = 0;
      for (int i = 0; i < tripGeometry.getNumPoints() - 1; i++) {
        try {
          distance += JTS.orthodromicDistance(tripGeometry.getCoordinateN(i), tripGeometry.getCoordinateN(i + 1), DefaultGeographicCRS.WGS84);
        } catch (TransformException e) {
          throw new RuntimeException(e);
        }
      }

      return distance;
    }
public static double getDistance(LineString tripGeometry) {
      double distance = 0;
      for (int i = 0; i < tripGeometry.getNumPoints() - 1; i++) {
        try {
          distance += JTS.orthodromicDistance(tripGeometry.getCoordinateN(i), tripGeometry.getCoordinateN(i + 1), DefaultGeographicCRS.WGS84);
        } catch (TransformException e) {
          throw new RuntimeException(e);
        }
      }

      return distance;
    }
public static double getDistance ( LineString tripGeometry ) { double distance = 0 ; for ( int i = 0 ; i < tripGeometry . getNumPoints ( ) - 1 ; i ++ ) { try { distance += JTS . orthodromicDistance ( tripGeometry . getCoordinateN ( i ) , tripGeometry . getCoordinateN ( i + 1 ) , DefaultGeographicCRS . WGS84 ) ; } catch ( TransformException e ) { throw new RuntimeException ( e ) ; } } return distance ; }
Get the length of a linestring in meters
Get the length of a linestring in meters