Say I have a latitude of 38.802610 and a longitude of -116.419389 and I want to be able to add a distance to that, 20 miles for example.
So far I have came up with a rough idea on how I would do this
Firstly, work out how many miles are in 1° of latitude, say for example it was 30
Then, divide one by it:
- 1 / 30 = 0.033333
- Add it to my original latitude to get my maximum ° of latitude:
- 38.802610 + 0.033333 = 38.8355943
- Subtract it to my original latitude to get my minimum ° of latitude:
- 38.802610 - 0.033333 = 38.769277
But this is flawed because there seems to be no direct conversion for longitude as from what I've read the calculation varies.
Ultimately, I need to be able to find out the:
- maximum latitude (my current latitude + given distance e.g 20 miles)
- minimum latitude (my current latitude - given distance e.g 20 miles)
- maximum longitude (my current longitude + given distance e.g 20 miles)
- minimum longitude (my current longitude - given distance e.g 20 miles)
Any help would be greatly appreciated, thank you.