Geo { @Nonnull public static Duration estimatedMinTravelTime( @Nonnull final GeoPoint from, @Nonnull final GeoPoint to) { return estimatedMinTravelTime(from, to, 1); } private  Geo(); @Nonnull static GeoRectangle grow(@Nullable final GeoRectangle rectangle, @Nonnull final GeoPoint point); static double degreesLatToMeters(final double latDegrees); static double degreesLonToMetersAtLat(final double lonDegrees, final double lat); static double metersToDegreesLat(final double northMeters); static double metersToDegreesLonAtLat(final double eastMeters, final double lat); static double distanceInMeters(@Nonnull final GeoPoint p1, @Nonnull final GeoPoint p2); static double mapToLat(final double lat); static double mapToLon(final double value); @Nonnull static Duration estimatedMinTravelTime(
            @Nonnull final GeoPoint from,
            @Nonnull final GeoPoint to); @Nonnull static Duration estimatedMinTravelTime(
            @Nonnull final GeoPoint from,
            @Nonnull final GeoPoint to,
            final int roundToMeters); static final double EARTH_RADIUS_X_METERS; static final double EARTH_RADIUS_Y_METERS; static final double EARTH_CIRCUMFERENCE_X; static final double EARTH_CIRCUMFERENCE_Y; static final double METERS_PER_DEGREE_LAT; static final double METERS_PER_DEGREE_LON_EQUATOR; static final double LON180; }
@Test public void testEstimatedMinimumTravelTime() { LOG.info("testEstimatedMinimumTravelTime"); final GeoPoint from = new GeoPoint(0.0, 0.0); final GeoPoint to0m = from; final GeoPoint to500m = from.translate(0, 500); final GeoPoint to1000m = from.translate(0, 1000); final GeoPoint to1200m = from.translate(0, 1200); final GeoPoint to1500m = from.translate(0, 1500); final GeoPoint to2000m = from.translate(0, 2000); final GeoPoint to2500m = from.translate(0, 2500); final GeoPoint to99km = from.translate(0, 99000); final GeoPoint to100km = from.translate(0, 100000); final Duration sec0m = Duration.standardSeconds(0); final Duration sec500m = Duration.standardSeconds(120); final Duration sec1000m = Duration.standardSeconds(240); final Duration sec1200m = Duration.standardSeconds(240 + 36); final Duration sec1500m = Duration.standardSeconds(240 + 90); final Duration sec2000m = Duration.standardSeconds(240 + 180); final Duration sec2500m = Duration.standardSeconds(240 + 180 + 60); final Duration sec99km = Duration.standardSeconds(6007); final Duration sec100km = Duration.standardSeconds(6059); Assert.assertEquals(sec0m.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to0m, 1).getStandardSeconds()); Assert.assertEquals(sec500m.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to500m, 1).getStandardSeconds()); Assert.assertEquals(sec1000m.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to1000m, 1).getStandardSeconds()); Assert.assertEquals(sec1200m.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to1200m, 1).getStandardSeconds()); Assert.assertEquals(sec1500m.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to1500m, 1).getStandardSeconds()); Assert.assertEquals(sec2000m.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to2000m, 1).getStandardSeconds()); Assert.assertEquals(sec2500m.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to2500m, 1).getStandardSeconds()); Assert.assertEquals(sec99km.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to99km, 1).getStandardSeconds()); Assert.assertEquals(sec100km.getStandardSeconds(), Geo.estimatedMinTravelTime(from, to100km, 1).getStandardSeconds()); }