How can I measure distance and create a bounding box based on two latitude+longitude points in Java?

Here is a Java implementation of Haversine formula. I use this in a project to calculate distance in miles between lat/longs. public static double distFrom(double lat1, double lng1, double lat2, double lng2) { double earthRadius = 3958.75; // miles (or 6371.0 kilometers) double dLat = Math.toRadians(lat2-lat1); double dLng = Math.toRadians(lng2-lng1); double sindLat = Math.sin(dLat / … Read more

Calculating distance between two geographic locations

http://developer.android.com/reference/android/location/Location.html Look into distanceTo Returns the approximate distance in meters between this location and the given location. Distance is defined using the WGS84 ellipsoid. or distanceBetween Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. Distance and bearing are defined using the … Read more

Geographic / geospatial distance between 2 lists of lat/lon points (coordinates)

To calculate the geographic distance between two points with latitude/longitude coordinates, you can use several formula’s. The package geosphere has the distCosine, distHaversine, distVincentySphere and distVincentyEllipsoid for calculating the distance. Of these, the distVincentyEllipsoid is considered the most accurate one, but is computationally more intensive than the other ones. With one of these functions, you … Read more

How to get a time zone from a location using latitude and longitude coordinates?

Time Zone Location Web Services Google Maps Time Zone API Bing Maps Time Zone API Azure Maps Time Zone API GeoNames Time Zone API TimeZoneDB API AskGeo – commercial (but arguably more accurate than GeoNames) GeoGarage Time Zone API – commercial, focusing on Nautical time zones. Raw Time Zone Boundary Data Timezone Boundary Builder – … Read more