[Swlug] Maths calculations (distances travelled)

Jason Pearce jpearce at etlp.co.uk
Wed Jul 20 12:43:35 UTC 2022


It looks like your inputs are in degrees (of longitude and latitude), so then you need to do your calculations accordingly (you can't switch to radians, unless you first convert your inputs into radians).

To convert degrees of latitude travelled into a distance on the ground (assuming no change in longitude, and that what you are measuring does not go up over one of the poles and back down the other side), multiply by the circumference of the earth over 360 (or equivalently, by a quarter of the circumference of the earth over 90).  You can see that this is right if you consider an object travelling along say the Greenwich meridian from the equator to the North Pole.  It will have travelled 90 degrees of latitude, and multiplying this by a quarter of the circumference of the earth over 90 will give the result: a quarter of the circumference of the earth, which indeed is the distance travelled.

Of course, to convert from the diameter of the earth to the circumference, multiply the diameter by pi.

To convert degrees of longitude at the equator to latitude, do the same calculation.  It does not work away from the equator.  You will see on a globe with degrees of longitude and latitude marked on it, that the degrees of latitude never get closer together, but the degrees of longitude converge at the poles.  So if you travel at the equator from say 0 degrees to 90 degrees West, you will have travelled a quarter of the circumference of the earth, but if you are just a foot from the North Pole when you do it, you can do it in a single step.

So away from the equator, you need to take not the circumference of the earth, but the circumference of the line of latitude that you are on (lines of latitude of course being circles), which is of course two*pi*radius of the line of latitude.  Visualisation of a right angle triangle with one of the short sides being the radius of the circle described by the line of latitude in question, and the other short side going from the centre of that circle to the centre of the earth (and you will see that the hypotenuse of the triangle extends from the centre of the earth to the surface and therefore is equal to the radius of the earth), shows that the radius of the line of latitude is equal to the radius of the earth times the sine of the latitude.

So the formula for the distance travelled by an object moving along a line of latitude through a certain amount of 'degrees' of longitude with be equal to the number of degrees of longitude travelled times the circumference of the earth times the sine of the latitude divided by 360.

If you have a change in both longitude and latitude, then having calculated the latitude distance and the longitude distance (this will not be exact because you have to decide what latitude to use in your formula, when in fact the latitude has changed, but provided the latitude has not changed by much it will be close enough), you can then use Pythagoras' theorem, as you have done, to calculate the total distance (which will be the hypotenuse of the right angle triangle formed whose (shorter) sides are the change in longitude and the change in latitude).  Note here that Pythagoras' theorem does not work on a sphere (to see that this is so, think of a 'triangle' on the earth where one side lies along the equator from 0 latitude to 90 degrees West, one side runs from the equator to the North Pole along the Greenwich meridian, and one side runs from the equator to the North Pole along the 90 degrees West meridian: all angles of this triangle are right angles, so any of the three sides can be considered the 'hypotenuse', but all sides are equal so the triangle does not accord with Pythagoras' theorem).  However, the shorter the distance, the more nearly the sides will accord with Pythagoras.

Also note that there are various other approximations in play here, such as the earth being considered a perfect sphere (which it is not) and that the drone is travelling close enough to the surface of the earth that the extra distance is has to travel by virtue of being higher up is not appreciable (think of a space-ship orbiting the earth very far away from the earth and you will see that is has to travel much larger distances to cover the same number of degrees on the ground below it).

So in summary, you could use as a (hopefully) reasonable approximation the formula:   Distance = (pi*D / 360 )*Square-root [ {V2 - V1}^2 + { sin(V1)*(H2 - H1) }^2 ]

Where V2, H2 are the final latitude and longitude respectively, V1 and H1 are the initial latitude and longitude, all in degrees, and D is the diameter of the earth.  Note that I have arbitrarily used sin(V1) in the formula rather than sin(V2) or even the sine of the average of V1 and V2 (which might be best), on the assumption that the change in latitude will be so small that for your purposes it does not matter which is used.  (Note that all of this might not be very accurate in calculating the distance between the Tower of London and the Arc de Triomphe, for reasons I have already mentioned, and depending of course on how accurate you require it to be, but I presume that with the drone itself, you will be taking readings far more frequently than the time it takes to fly that distance, assuming it is even capable of it.)

I did 'A' level maths, though I don't think the above goes beyond 'O' level.

If anyone spots an error in my formula, not doubt they will speak up!

I've had to delete the rest of the thread because I got a message saying that my message was too big.

Jason


Jason Pearce
Partner
Direct Dial: 01633 265984
Email: jpearce at etlp.co.uk
IMPORTANT NOTICE: CYBERCRIME ALERT!
​
​Please note that Everett Tomlin Lloyd & Pratt’s bank account details will NOT change during the course of a transaction. Please be vigilant and exercise caution when opening any emails, attachments or links and when responding to any requests for your bank account details. We will not accept responsibility if you transfer money into an incorrect bank account. We will NEVER inform you via email or text message of any change in our firm's bank details. You are advised to telephone our office to confirm our bank details BEFORE you transfer any money to us.

 
Central Switchboard: 01495 763 333
www.etlp.co.uk
 
Newport Office 19-20 Gold Tops, Newport, NP20 4PH. Fax: 01633 251840. newport at etlp.co.uk
Pontypool Office, 17 Commercial Street, Pontypool, NP4 6JQ. Fax: 01495 750526. pontypool at etlp.co.uk
 
Partners:  Ashley Harkus, Kirsten Tuck, Jason Pearce, Kay Perrott, Sarah Purnell.
 
Consultants: Robert Twigg, Jonathan Stephens, Gareth Edwards (Non-practicing) & Chris Pennant (Non-practicing) 
 
​This firm is regulated by the Solicitors Regulation Authority.
SRA NO: 00049459

The contents of this email and any attachments are the property of Everett Tomlin Lloyd and Pratt Solicitors and are intended for the confidential use of the named recipient(s) only. If they have been received in error you must maintain confidentiality, notify us of the error, destroy copies and delete them from your system. Everett Tomlin Lloyd and Pratt Solicitors operates an e-mail and internet policy which provides for the monitoring of any or all email transmissions and any e-mail sent from or to Everett Tomlin Lloyd and Pratt may be subject to such monitoring.
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/swlug/attachments/20220720/220b5478/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image599959.gif
Type: image/gif
Size: 4793 bytes
Desc: image599959.gif
URL: <http://mailman.lug.org.uk/pipermail/swlug/attachments/20220720/220b5478/attachment-0001.gif>


More information about the Swlug mailing list