Page 1 of 1

Latitude, longitude and distance

Posted: Mon Jul 09, 2018 2:14 am
by Roddy Dog
I have latitude and longitude coordinates for a range of cities. Can RATS compute the bilateral distances between them? If so, advice would be appreciated. Many thanks.

Re: Latitude, longitude and distance

Posted: Mon Jul 09, 2018 7:18 am
by TomDoan
The (great circle) distance is relatively straightforward once the latitude and longitude are converted to radians. In what format do you have them now?

Re: Latitude, longitude and distance

Posted: Wed Jul 11, 2018 6:24 pm
by Roddy Dog
Hi Tom, I have the latitude and longitude data in decimal degrees.

Re: Latitude, longitude and distance

Posted: Wed Jul 11, 2018 10:57 pm
by TomDoan
See https://www.movable-type.co.uk/scripts/latlong.html. If you have latitude as running from -90 (South) to +90 (North), then you convert to radians by multiplying those by %PI/180. If you have longitude from -180 to +180, similarly convert to radians by multiplying by %PI/180. The ATAN2(y,x) function in the Javascript code is the RATS function %ATAN(y/x). (ATAN2 is designed to handle x=0).