1. Resident Curmudgeon
Join Date
Feb 2004
Location
In front of the computer
Posts
15,579

Does anybody have a relatively easy way to calculate the longitude of that is N kilometers east/west of a given latitude/longitude location? I can handle the north/south latitude easily by computing it from the longitudinal meridian distance, but the east/west longitude is taxing my poor feeble brain.

I'm trying to do this to create a stored procedure as a helper object for a completely home grown business mapping tool, so links to a web site that will do the job are plentiful but not useful!

-PatP

Join Date
Nov 2004
Location
out on a limb
Posts
13,692
easy no
but it can be done
have a look at movabletype
requires trig functions
I've used their equations in VB and Java and the accuracy is greater than 0.0001% on my tests

just a thought, if Transact can't handle trig then would somehting like MySQL with the spatial extensions be a better bet
Last edited by healdem; 04-16-13 at 19:00.

3. Resident Curmudgeon
Join Date
Feb 2004
Location
In front of the computer
Posts
15,579
Aha, thank you! The Destination from Distance-Bearing calculation is exactly what I wanted.

The best part is that I only have to compute it once for this purpose, since the points that I need are symmetrical, equal, and opposite.

Now I can happily toddle off in search of a new problem!

-PatP

Join Date
Nov 2004
Location
out on a limb
Posts
13,692
Good luck with that. it works, but it can get a bit brain melting translating the equations into workign code, and then testing. I guess it depends on how much control you have of the incoming data. I tghink I got to over 1,000 unit tests just on the formats used in navigation NOT forgettign the others.

FWIW bear in mind that:-
1 degree of Latitude equates to 1 Nautical Mile AT SEA LEVEL
although 1 nautical mile also equates to 1 degree of Longitude AT THE EQUATOR AT SEA LEVEL, it doesn't as you increase the latitude
although I don't 'trust' Wikipedia this seems about right
Code:
```Deg     Lat             Long
0°	110.574 km	111.320 km
15°	110.649 km	107.551 km
30°	110.852 km	96.486 km
45°	111.132 km	78.847 km
60°	111.412 km	55.800 km
75°	111.618 km	28.902 km
90°	111.694 km	0.000 km```
those assumptions work at SEA LEVEL, at a different altitude 1 degree of Latitude will vary. if your proposed app assumes level flat ground then whatever error is introduced because of altitude will be consistent, but if there are significant differences in altitude over the plane then there could be additional variation.

if you are looking for a bounding box you should be fine, a bounding circle can be tricky as strictly speaking it should be an ellipsoid
but if you accuracy requirements are not critical it should be fine. by critical I mean sub 5m

5. Resident Curmudgeon
Join Date
Feb 2004
Location
In front of the computer
Posts
15,579