Use this simple function to calculate the **Distances between Latitude and Longitude with AutoHotkey**

#### Calculating Distances between Latitude and Longitude with AutoHotkey

### The key idea of the video is to explain how to calculate distances between latitude and longitude coordinates using a formula and the “m” function in AutoHotkey.

- 00:00 💡 This script calculates the distance between two latitude/longitude locations, taking into account the curvature of the earth.
- 00:35 💡 The function “distances” calculates distances between latitude and longitude using four parameters: lat one, lon one, lat two, and lon two, with a static value of one degree and a radian.
- 00:56 😕 The speaker found a method online and adapted it to autohot eco.
- 01:05 💡 The speaker discusses calculating distances between latitude and longitude using a formula and converting the result from kilometers to meters and miles.
- 01:44 💡 The formula calculates the distance between latitude and longitude in kilometers and miles.
- 02:26 💡 The speaker discusses latitude and longitude coordinates and mentions specific values for a location, but doesn’t provide any further information.
- 02:49 📝 The speaker explains how to use the “m” function in AutoHotkey to calculate distances between latitude and longitude, providing a convenient and accurate way to compare locations.

hey it’s joe Glinesfrom the-Automator and i wanted to share this script with you because i could actually forgot i had written it what it does is it calculates the distance between two latitude slash longitude locations so you have one latin launch and you want to compare to the other one and get the distance now the distance in the formula i’m going to show you as well as some of the conversions it takes into account the curvature of the earth otherwise a direct line can be close but you know in long distances it has a bigger effect

short distances you know a couple feet it wouldn’t matter but across the country it would so let’s go ahead and jump into the the function here now so i have a function here called distances and it takes four parameters so there’s lat one lawn one which could also be longitude right however you want to say it and lat two and lawn two so it’s going to take these fourthis is a static value it’s just getting this p it’s a it’s one degree and a radian if you remember what that is

and this formula here i’m probably gonna i honestly don’t i didn’t study it right soi’m not that i don’t think i could have come up with it but i just found it online and adapted it to autohot eco actually i think mastery has adapted it for me we were working on it one day and we were trying to calculate distances between thingsto get an idea of where things are and we came up with this and in reality what we had done i couldn’t remember what the metric was so it turns out this

is kilometers so i created an object here is just to store it so we can return more than one result here we take this formula and dump it into kilometers and then what i did was i said hey let’s just look up okay how do you convert kilometers to meters okay it’s ayou need to multiply it by a thousand so that’ll give us the distance of meters what about miles i based them off off of the kilometers because i’ve already calculated that so i just looked up what the formula is for each of these things

uh and it returns the dist which is this object and that’s going to store it here in distance so let’s first let’s do a message box you know what i don’t want let’s just call it b b there we go so d and then dot and here we’re going to say let’s do kilometers to start all right i’m just going to copy and paste because i’m lazy so i’m going to launch this and run it so that is 3536.

60 kilometers now what if we want mileslet’s just change this to miles because that’s an object right this is how we access it so that’s 2197.54 miles now in another tool i have i took these latitudes and longitudes let’s grab this i took this latitude longitudeand so this is basically la to orlando i believe it was and you can probably if we looked at it we would see these are the the latin laws of each place and look this is 2180 2197.

5 hey you know what that’s you know that’s good enough for me so that’s how you would use this right now if you had masteries function m function well we can just look at it all so i’m going to say m the the m of cAutose is in my library i’ll put a link to this functionwhat i love about it is when i hit myHotkey value pair so basically you need to think about its d to access the b dot d dot feet d dot kilometers d dot meters d dot miles d dot yards and so this is a great thing if you

happen to have two latitude and longitudes that you’re trying to compare this is a great easy way fairly accurate that you should be able to calculate that distance cheers