How to find a set of lat/long pairs surrounding a 5 miles radius of a certain location expressed in lat/long or as a address.
-
what do you mean by set of lat/long pairs do you mean every lat long surrounding the certain location or some of the lat/long pairs – Raghurocks Nov 28 '12 at 06:36
-
some of them would be preferable, but within a radius which I specify (say important landmarks or cities surrounding that lat/long) – Joe Nov 28 '12 at 08:27
-
http://stackoverflow.com/questions/5031268/algorithm-to-find-all-latitude-longitude-locations-within-a-certain-distance-fro this might be helpful – Raghurocks Nov 28 '12 at 08:33
-
Do you want some coordinates that build a circle or a rectnagle arround a center point given in lat/lon and radius in meter? – AlexWien Nov 28 '12 at 18:38
-
co-ordinates that build a circle, but definitely within the circle. – Joe Nov 30 '12 at 04:01
1 Answers
First you decide how many (lat,lon) pairs you want to have:
You could want to have 4 cordinates forming a square arround the center point.
Or you decide to have a regualr N-Gon around the center point.
Then you use a projection from lat/lon to meters, e.g EquiDistantProjetion.
This allows you to transform the lat/lon center to cartesian meters,
where you then can calculate like you have learned it in school.
Now you having the center point in cartesian meters:
Then you use the Polar coordinate form of a coordinate (r, phi) to calculate the corner points of the square or N-gon.
(centerX + r* sin(phi), centerY + r* cos(phi)).
Finally you have to use the inverse tranformation to transform your coordinate pairs back to lat/lon.
The EquiDistantProjection works for distances up to some 100 miles. It does not work well above 80 deg latitude. (Polar region)

- 28,470
- 6
- 53
- 83