Details
-
Type: extRequest
-
Status: Closed
-
Priority: Major
-
Resolution: Done
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
Labels:None
-
Sender Email:
-
HD-Chapter:Data
-
HD-Enabler:CEP
Description
Thomas Cristanis sent a message using the contact form at
http://catalogue.fiware.org/.
Hi Dear,
I wanted to know more details not provided by documentation relative the
function distance. If you can use directly in the field condition of my
Event?
What kind of value returned? (meters, kilometers)?
_______________________________________________
Fiware-tech-help mailing list
Fiware-tech-help@lists.fiware.org
https://lists.fiware.org/listinfo/fiware-tech-help-new
[Created via e-mail received from: thomascristanis@gmail.com]
Activity
- All
- Comments
- History
- Activity
- Transitions
Dear Thomas,
Distance:
You need to provide 4 parameters, 2 for the first point and 2 for the second. These parameters are used as the (X,Y) coordinates of the 2 points you want to measure the distance between.
The function calculate a geometric distance, sqrt((y2-y1)^2 + (x2-x1)^2), so the result will be in the same units as the input.
To refer to attribute of an event use the following: <EventName>.<EventAttributeName> for example attribute x of event a: a.x
So if event a has attributes x,y and event b has attributes x,y , you can refer to the distance between those two points by writing:
distance(a.x,a.y,b.x,b.y)
You can use this function directly in the condition of an input event assuming this event has the attributes of the two points.
Best regards,
Itai