Getting a square mile bounding box anchored by coordinates?

Let's say I have a lat/lng coordinate pair. I want to determine the coordinates that would create a square mile box. The existing coordintae pair would be the top left of the box, and the coordinate pair I'm trying to calculate would be the lower right.

What's the best way to handle this? A solution using GeoDjango would be great, but PostGIS or even a mathematical formula would be good too.

-

There are some difficulties in calculating such a thing because of earth's curvature. One degree in 0º lat is bigger then in -30º lat.

WARNING: don't take these as real.

1 degree longitude in 0º latitude, corresponds approximately to 111km. You can use trignometry functions to better estimate in other latitudes and calculate this in miles.

There is probably an easier way.

-
I just needed a quick and dirty solution, with little need for accuracy. Just a ballpark measurement, which this answered nicely. –  Eric Palakovich Carr Jul 31 '10 at 19:25

For quick and dirty, you could just use a spherical approximation.

For lat and lon in degrees, placing lat1,lon1 SouthEast of lat0,lon0 per your example:

``````dlon = RadianToDegree * BoxSizeMi/EarthRadiusMi
dlat = dLon / cos(lat0 / RadianToDegree)
lat1 = lat0 + dlat
lon1 = lon0 - dlon
``````

For a box size on the order of a mile, this should give a visual result indistinguishable from a more accurate calculation (say if you were plotting the box as lines on an image while somebody moved the mouse pointer). Pick a reasonable earth radius in the same units as your box size; the geometric mean of the equatorial and polar radii would be one simple choice.

You can get far more accurate, but in true high accuracy the question is ambiguous; for example going east exactly one mile and then south exactly one mile is not the same point as going south and then east (because the meridians or north/south lines are not parallel except right at the equator).

There are intermediate precision solutions if the above is too dirty.

Things get wacky near the poles for this reason, whether you attempt precision or use quick and dirty approximations.

-

It really depends on what you are trying to accomplish. Do you want a rough guess or as accurate as possible. Any which way the result will always have some sort of error associated with it.

Take Lat/Long for example, it would be difficult to determine the mile length in the (X) Longitude Direction, as the curvature latitudes converge as you approach the poles.

Introducing projections: Local projections are determined to reduce the overall errors. One could use a local projection to determine the bounds, and transform it back to Lat/Long, but that would be too intense.

I wouldn't use upper/left rather I would use center, and determine the bounds outwards and approximate the size of Longitude needed to obtain a mile in the X (W/E) direction. This would be based on the Latitude

-

I'd take your starting coordinate and convert it into a UTM coordinate, choosing the appropriate zone.

Then, go east 1609.344 meters and south 1609.344 meters. Convert back to lat/long.

For completeness I would get all four points from the UTM projection, as your square mile may actually appear to be a trapezoid on your display map.

-

Using ESRI's Projection Engine DLL (bundled with the freely downloadable ArcExplorer) you could use the GeodesicCoordinate function to find a point a specified distance southeast of your given point.

If using in a .NET environment, see Richie Carmichael's blog post.

-