Trigger when you are kilometers/miles from a location

paps93fr

New member
Hi there,

MD have Geofence triggers but they are 5 kms max adjustable from a position.

How to know when I'm hundreds of km/ml away, for example from home ?

I want to create some presence routines but I need to know - and differentiate - when i'm out of my home region, from just being out of my street or city.

I would like to know, for example, when I am 150 or 200 km from home.
 

Dm114

Well-known member
Hi there,

MD have Geofence triggers but they are 5 kms max adjustable from a position.

How to know when I'm hundreds of km/ml away, for example from home ?

I want to create some presence routines but I need to know - and differentiate - when i'm out of my home region, from just being out of my street or city.

I would like to know, for example, when I am 150 or 200 km from home.
Unless you create Geofence areas for these distances, I'm afraid there's no other way to achieve that.
 

paps93fr

New member
I answer to myself and to anyone interested.

I've found formulas in this website:

Translated in MD (first image in French, last in English):
🌎_Distance_entre_deux_coordonnées_GPS.png

🌎_Distance_entre_deux_coordonnées_GPS (2).png

Seem working well.

Coordinates are string variables like this:
Screenshot_20231104_125056_MacroDroid.jpg

Which are manipulated to convert them into decimal array:
SmartSelect_20231104_125142_MacroDroid.jpg
 

Dm114

Well-known member
I answer to myself and to anyone interested.

I've found formulas in this website:

Translated in MD (first image in French, last in English):
View attachment 7421

View attachment 7422

Seem working well.

Coordinates are string variables like this:
View attachment 7423

Which are manipulated to convert them into decimal array:
View attachment 7424
Ha, ha... Well done 😃

I didn't dare to suggest this method because:
- calculation is a bit long and
- the result is given for a straight line, we no curves 😉

To minimize the inconvenience of the last point, you could apply a percentage to increase the calculated distance, depending on the kind of roads you are driving on.

For those who are interested, here's the Wikipedia link:
 

paps93fr

New member
To minimize the inconvenience of the last point, you could apply a percentage to increase the calculated distance, depending on the kind of roads you are driving on.
Thank you. For my today's use - to see if I'm far away from home or not - that first version will be okay. But I note that point if my use case change.
 

Dm114

Well-known member
Thank you. For my today's use - to see if I'm far away from home or not - that first version will be okay. But I note that point if my use case change.
I just uploaded to the Template Store an old macro now converted to Action Block (it didn't exist yet at this time 😉) to calculate the distance between 2 GPS points (if it can help you)...

 
Top