Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am looking into ways of grouping large sets of latitude/longitude coordinates and am wondering if there is an easy/standard way to roughly calculate the number of different coordinates in a given area.

If I have a coordinate 41.174104, -87.853926, how many other coordinates are there at that same level of precision within a mile radius? And if I decrease the precision to 3 decimals 41.174, -87.853, how many different coordinates are there within a mile radius of that?

Just looking for a point in the right direction, I'm a software guy, no serious math background. Thanks.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Since you only want to calculate the number roughly and the distance of a mile is small compared to the Earth's radius, it should be sufficient to use a linear approximation with the surface element of the transformation to Cartesian coordinates. For a rough calculation, we can take the Earth as spherical and assume that the latitude and longitude are spherical coordinates $\theta$ and $\phi$, respectively. The surface element for spherical coordinates is $r^2\sin\theta\mathrm d\theta\mathrm d\phi$. Loosely speaking, that means that an infinitesimal area $\mathrm d\theta\mathrm d\phi$ in the coordinate space corresponds to an infinitesimal surface area $r^2\sin\theta\mathrm d\theta\mathrm d\phi$ on the actual surface of the sphere. For your purposes, we can take $\sin\theta$ as constant, in which case the areas are simply proportional to each other, with proportionality constant $r^2\sin\theta$. For your purposes, we can calculate the area of the circle as if it were flat, so a circle with a radius of one mile has an area $A$ of $\pi$ square miles. The radius $r$ of the Earth is roughly $4000$ miles, and at latitude $\theta=41.174104^\circ$ we have $\sin\theta\approx0.66$, so the corresponding area in coordinate space is $A/(r^2\sin\theta)\approx\pi/(4000^2\cdot0.66)\approx3\cdot10^{-7}$. The area per grid point in a grid of coordinates with $d$ decimals is $(10^{-d})^2=10^{-2d}$, so for instance if you use $d=6$ digits you'd have roughly $3\cdot10^{-7}/10^{-12}=3\cdot10^5$ different coordinates within a one-mile radius, whereas if you use $d=3$ digits the result is $3\cdot10^{-7}/10^{-6}=0.3$, so you wouldn't expect any other coordinates within that radius.

share|improve this answer
    
awesome answer, thank you! –  Lance Pollard Aug 23 '11 at 6:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.