Contact us for all your questions
Fibaro:calculateDistance command
fibaro:calculateDistance()
Actieon :
Calculates the distance between 2 geografical points
Uasge and parameters :
fibaro:calculateDistance(position1, position2)
- position1: first location
- position2: second location
A location is detemermend by latitude and longitude. Values are displayed in degress with a decimal point (no comma) and are seperated by a semicolom. Negative values are West and Soouth
Example, point 40°44’55″N, 73°59’11″W will be “40.7486;-73.9864″.
Return value:
Distance in meters.
Programmeervoorbeeld :
local eigenlocatie = fibaro:getValue(123, 'Location') --123 is het ID van de gebruiker
local voorbeeldlocatie = "51.6578349135172;18.6398273982745";
local result;
result = fibaro:calculateDistance(eigenlocatie,voorbeeldlocatie);
fibaro:debug('De afstand bedraagt' ..result.. " Meter");