GeoLine extends GeoObject { public double getLengthMeters() { return Geo.distanceInMeters(southWest, northEast); } GeoLine(
            @Nonnull final GeoPoint southWest,
            @Nonnull final GeoPoint northEast); @SuppressWarnings({"ConstantConditions", "UnusedDeclaration"}) @Deprecated private  GeoLine(); @Nonnull @Override GeoPoint getOrigin(); @Nonnull @Override GeoPoint getCenter(); @Nonnull GeoPoint getSouthWest(); @Nonnull GeoPoint getNorthEast(); @Nonnull GeoLine withSouthWest(@Nonnull final GeoPoint southWest); @Nonnull GeoLine withNorthEast(@Nonnull final GeoPoint northEast); @Nonnull @Override GeoLine translate(@Nonnull final GeoVector vector); @Nonnull @Override GeoLine moveTo(@Nonnull final GeoPoint origin); double getNorthing(); double getEasting(); double getLengthMeters(); boolean isWrappedOnLongSide(); @Nonnull static GeoLine getShortestLine(
            @Nonnull final GeoPoint from,
            @Nonnull final GeoPoint to); double getHeading(); @Override boolean canEqual(@Nonnull final Object obj); @Override boolean equals(@Nullable final Object obj); @Override int hashCode();  }
@Test public void testGetLengthMeters() { LOG.info("testGetLengthMeters"); final GeoPoint o = new GeoPoint(-0.5, 10.0); final GeoPoint x = new GeoPoint(0.5, 10.0); final GeoPoint y = new GeoPoint(0.5, 11.0); final GeoLine ver = new GeoLine(o, x); final GeoLine dia = new GeoLine(o, y); final double len1 = Geo.METERS_PER_DEGREE_LAT; final double len2 = ver.getLengthMeters(); Assert.assertEquals(0, Double.compare(len1, len2)); final double len = 157000; Assert.assertTrue(Math.abs(len - dia.getLengthMeters()) < 200.0); }
@Test public void testGetLengthMetersWithElevation() { LOG.info("testGetLengthMetersWithElevation"); double ref = Geo.METERS_PER_DEGREE_LAT; GeoPoint x1 = new GeoPoint(-0.5, 10.0, 10.0); GeoPoint x2 = new GeoPoint(0.5, 10.0, 10.0); GeoLine y = new GeoLine(x1, x2); double len = y.getLengthMeters(); Assert.assertEquals(0, Double.compare(len, ref)); x1 = new GeoPoint(-0.5, 10.0); x2 = new GeoPoint(0.5, 10.0, 10.0); y = new GeoLine(x1, x2); len = y.getLengthMeters(); Assert.assertEquals(0, Double.compare(len, ref)); x1 = new GeoPoint(-0.5, 10.0, 0.0); x2 = new GeoPoint(0.5, 10.0, Geo.METERS_PER_DEGREE_LAT); y = new GeoLine(x1, x2); len = y.getLengthMeters(); ref = 156901.70221587716; Assert.assertEquals(0, Double.compare(len, ref)); }