I\'m using OpenLayers with an ordinary mercator map and I\'m trying to sample a bounding box by finding a grid of points in latlong. The bbox is expressed in latlon, e.g.
<Use the haversine formula to get the distance between two points of lat/long. This assumes the earth is a sphere (which is, for most cases, "good enough").
A Javascript implementation of it (shamelessly stolen from here) looks like this:
var R = 6371; // km
var dLat = (lat2-lat1).toRad();
var dLon = (lon2-lon1).toRad();
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
The transformation between degrees and metres varies across the Earth's surface.
Assuming a spherical Earth, degrees latitude = distance * 360 / (2*PI * 6400000)
Note that longitude will vary according to the latitude:
Degrees longitude = distance *360 * / (2*PI* cos(latitude) )
The above is for the Earth's surface, and does not use the Mercator projection. If you wish to work with projected linear distance, then you will need to use the Mercator projection.
Without allowing for the slightly non-spherical shape of the earth,
One minute of latitude North to south = 1 Nautical Mile = 6075 feet So One degree = 60 Minutes = 60 * 6075 feet There are 3.28 Feet in a meter so One degree = 60 * 6075 / 3.28 Meters = 111,128 meters
Alternatively, one minute of Latitude = 1,852 Meters So One degree = 60 * 1852 meters = 111,120 meters
I'm not sure which is more accurate...
For One degree of Longitude, do the same thing, but Multiply by the Cosine (Latitude) since the Longitude lines get closer together as you move north.