@Test public void destinationPointTest() { LatLong start = new LatLong(45, 45); LatLong expected = new LatLong(45.006352, 45.008984); LatLong actual = start.destinationPoint(1000, 45); Assert.assertEquals(LatLongUtils.degreesToMicrodegrees(expected.latitude), LatLongUtils.degreesToMicrodegrees(actual.latitude), 0); Assert.assertEquals(LatLongUtils.degreesToMicrodegrees(expected.longitude), LatLongUtils.degreesToMicrodegrees(actual.longitude), 0); }
public static LatLong destinationPoint(LatLong start, double distance, float bearing) { double theta = Math.toRadians(bearing); double delta = distance / EQUATORIAL_RADIUS; double phi1 = Math.toRadians(start.latitude); double lambda1 = Math.toRadians(start.longitude); double phi2 = Math.asin(Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta)); double lambda2 = lambda1 + Math.atan2(Math.sin(theta) * Math.sin(delta) * Math.cos(phi1), Math.cos(delta) - Math.sin(phi1) * Math.sin(phi2)); return new LatLong(Math.toDegrees(phi2), Math.toDegrees(lambda2)); }
LatLongUtils { public static LatLong destinationPoint(LatLong start, double distance, float bearing) { double theta = Math.toRadians(bearing); double delta = distance / EQUATORIAL_RADIUS; double phi1 = Math.toRadians(start.latitude); double lambda1 = Math.toRadians(start.longitude); double phi2 = Math.asin(Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta)); double lambda2 = lambda1 + Math.atan2(Math.sin(theta) * Math.sin(delta) * Math.cos(phi1), Math.cos(delta) - Math.sin(phi1) * Math.sin(phi2)); return new LatLong(Math.toDegrees(phi2), Math.toDegrees(lambda2)); } }
LatLongUtils { public static LatLong destinationPoint(LatLong start, double distance, float bearing) { double theta = Math.toRadians(bearing); double delta = distance / EQUATORIAL_RADIUS; double phi1 = Math.toRadians(start.latitude); double lambda1 = Math.toRadians(start.longitude); double phi2 = Math.asin(Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta)); double lambda2 = lambda1 + Math.atan2(Math.sin(theta) * Math.sin(delta) * Math.cos(phi1), Math.cos(delta) - Math.sin(phi1) * Math.sin(phi2)); return new LatLong(Math.toDegrees(phi2), Math.toDegrees(lambda2)); } private  LatLongUtils(); }
LatLongUtils { public static LatLong destinationPoint(LatLong start, double distance, float bearing) { double theta = Math.toRadians(bearing); double delta = distance / EQUATORIAL_RADIUS; double phi1 = Math.toRadians(start.latitude); double lambda1 = Math.toRadians(start.longitude); double phi2 = Math.asin(Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta)); double lambda2 = lambda1 + Math.atan2(Math.sin(theta) * Math.sin(delta) * Math.cos(phi1), Math.cos(delta) - Math.sin(phi1) * Math.sin(phi2)); return new LatLong(Math.toDegrees(phi2), Math.toDegrees(lambda2)); } private  LatLongUtils(); static boolean contains(LatLong[] latLongs, LatLong latLong); static boolean contains(List<LatLong> latLongs, LatLong latLong); static int degreesToMicrodegrees(double coordinate); static LatLong destinationPoint(LatLong start, double distance, float bearing); static double distance(LatLong latLong1, LatLong latLong2); static double distanceSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY); static LatLong fromString(String latLongString); static boolean isClosedWay(LatLong[] latLongs); static double latitudeDistance(int meters); static double longitudeDistance(int meters, double latitude); static double microdegreesToDegrees(int coordinate); static Point nearestSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY); static double[] parseCoordinateString(String coordinatesString, int numberOfCoordinates); static double sphericalDistance(LatLong latLong1, LatLong latLong2); static double validateLatitude(double latitude); static double validateLongitude(double longitude); static double vincentyDistance(LatLong latLong1, LatLong latLong2); static byte zoomForBounds(Dimension dimension, BoundingBox boundingBox, int tileSize); }
LatLongUtils { public static LatLong destinationPoint(LatLong start, double distance, float bearing) { double theta = Math.toRadians(bearing); double delta = distance / EQUATORIAL_RADIUS; double phi1 = Math.toRadians(start.latitude); double lambda1 = Math.toRadians(start.longitude); double phi2 = Math.asin(Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta)); double lambda2 = lambda1 + Math.atan2(Math.sin(theta) * Math.sin(delta) * Math.cos(phi1), Math.cos(delta) - Math.sin(phi1) * Math.sin(phi2)); return new LatLong(Math.toDegrees(phi2), Math.toDegrees(lambda2)); } private  LatLongUtils(); static boolean contains(LatLong[] latLongs, LatLong latLong); static boolean contains(List<LatLong> latLongs, LatLong latLong); static int degreesToMicrodegrees(double coordinate); static LatLong destinationPoint(LatLong start, double distance, float bearing); static double distance(LatLong latLong1, LatLong latLong2); static double distanceSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY); static LatLong fromString(String latLongString); static boolean isClosedWay(LatLong[] latLongs); static double latitudeDistance(int meters); static double longitudeDistance(int meters, double latitude); static double microdegreesToDegrees(int coordinate); static Point nearestSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY); static double[] parseCoordinateString(String coordinatesString, int numberOfCoordinates); static double sphericalDistance(LatLong latLong1, LatLong latLong2); static double validateLatitude(double latitude); static double validateLongitude(double longitude); static double vincentyDistance(LatLong latLong1, LatLong latLong2); static byte zoomForBounds(Dimension dimension, BoundingBox boundingBox, int tileSize); static final double EQUATORIAL_RADIUS; static final double INVERSE_FLATTENING; static final double POLAR_RADIUS; static final double LATITUDE_MAX; static final double LATITUDE_MIN; static final double LONGITUDE_MAX; static final double LONGITUDE_MIN; }