@Test public void testLengthOther() { assertEquals(0.0, Geo.lengthOf(gf.createPoint(new Coordinate(0, 0))), 1E-22); assertEquals(0.0, Geo.lengthOf(gf.createMultiPoint(new Point[]{ gf.createPoint(new Coordinate(0, 0)), gf.createPoint(new Coordinate(1, 1)) })), 1E-22); assertEquals(0.0, Geo.lengthOf(gf.createPolygon( constructRing(0, 0, 1, 1, 0, 1, 0, 0) )), 1E-22); assertEquals(0.0, Geo.lengthOf(gf.createMultiPolygon(new Polygon[]{ gf.createPolygon(constructRing(0, 0, 1, 1, 0, 1, 0, 0)), gf.createPolygon(constructRing(1, 1, 2, 2, 1, 2, 1, 1)) })), 1E-22); }
public static double lengthOf(LineString line) { double dist = 0.0; Coordinate[] coords = line.getCoordinates(); for (int i = 1; i < coords.length; i++) { dist += distanceBetweenCoordinates( coords[i - 1].y, coords[i - 1].x, coords[i].y, coords[i].x ); } return dist; }
Geo { public static double lengthOf(LineString line) { double dist = 0.0; Coordinate[] coords = line.getCoordinates(); for (int i = 1; i < coords.length; i++) { dist += distanceBetweenCoordinates( coords[i - 1].y, coords[i - 1].x, coords[i].y, coords[i].x ); } return dist; } }
Geo { public static double lengthOf(LineString line) { double dist = 0.0; Coordinate[] coords = line.getCoordinates(); for (int i = 1; i < coords.length; i++) { dist += distanceBetweenCoordinates( coords[i - 1].y, coords[i - 1].x, coords[i].y, coords[i].x ); } return dist; }  }
Geo { public static double lengthOf(LineString line) { double dist = 0.0; Coordinate[] coords = line.getCoordinates(); for (int i = 1; i < coords.length; i++) { dist += distanceBetweenCoordinates( coords[i - 1].y, coords[i - 1].x, coords[i].y, coords[i].x ); } return dist; }  static double distanceBetweenCoordinatesHaversine(
      double lat1, double lng1, double lat2, double lng2
  ); static double distanceBetweenCoordinates(
      double lat1, double lng1, double lat2, double lng2
  ); static double lengthOf(LineString line); static double lengthOf(MultiLineString multiline); static double lengthOf(GeometryCollection geometryCollection); static double lengthOf(Geometry geom); static double areaOf(Polygon poly); static double areaOf(MultiPolygon multipoly); static double areaOf(GeometryCollection geometryCollection); static double areaOf(Geometry geom); static double ringArea(LinearRing ring); static Geometry clip(Geometry obj, OSHDBBoundingBox bbox); static Geometry clip(Geometry obj, P poly); }
Geo { public static double lengthOf(LineString line) { double dist = 0.0; Coordinate[] coords = line.getCoordinates(); for (int i = 1; i < coords.length; i++) { dist += distanceBetweenCoordinates( coords[i - 1].y, coords[i - 1].x, coords[i].y, coords[i].x ); } return dist; }  static double distanceBetweenCoordinatesHaversine(
      double lat1, double lng1, double lat2, double lng2
  ); static double distanceBetweenCoordinates(
      double lat1, double lng1, double lat2, double lng2
  ); static double lengthOf(LineString line); static double lengthOf(MultiLineString multiline); static double lengthOf(GeometryCollection geometryCollection); static double lengthOf(Geometry geom); static double areaOf(Polygon poly); static double areaOf(MultiPolygon multipoly); static double areaOf(GeometryCollection geometryCollection); static double areaOf(Geometry geom); static double ringArea(LinearRing ring); static Geometry clip(Geometry obj, OSHDBBoundingBox bbox); static Geometry clip(Geometry obj, P poly); static double earthRadius; }