You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[This post has been migrated from the old forum, it was originally sent byuser2684on2020-06-29 10:43:13]
eGeoffrey is capable of handling a number of diverse information among those, positions on a map. Let's work on a earthquake use case today. As always, let's search the marketplace first:
$ sudo egeoffrey-cli search earthquakeegeoffrey-service-earthquake: Retrieve earthquake information
$ egeoffrey-cli startPulling egeoffrey-service-earthquake (egeoffrey/egeoffrey-service-earthquake:master-amd64)...master-amd64: Pulling from egeoffrey/egeoffrey-service-earthquakebdf0201b3a05: Already exists782863018686: Already exists56c01527c728: Already exists63dd63c63810: Already existsba2bf76730ce: Already existsdd9f70d76614: Already existsf58009fcf6d2: Already existsbaa7b01968c0: Already existseebefd015bd8: Pull completeDigest: sha256:f322688151336a2e083da3e35933aaebb2f681cbd6082b98fd88559ce787996cStatus: Downloaded newer image for egeoffrey/egeoffrey-service-earthquake:master-amd64demo_egeoffrey-database_1 is up-to-datedemo_egeoffrey-service-fcc_weather_1 is up-to-datedemo_egeoffrey-controller_1 is up-to-datedemo_egeoffrey-gateway_1 is up-to-datedemo_egeoffrey-service-system_1 is up-to-datedemo_egeoffrey-gui_1 is up-to-dateCreating demo_egeoffrey-service-earthquake_1 ... done
If we now connect back to eGeoffrey web interface, we notice a menu item called "Earthquake Service" under the section "Examples". If we click on it, we get a map with a "Ops something went wrong error message". This is because we need a Google Maps API key for making this map (and any other map in eGeofrey working fine.
To do so, let's go to https://developers.google.com/maps/documentation/embed/get-api-key and get an API key. Once done, go back to eGeoffrey, go to "House" / "Settings" and under the "Web Interface" tab let's paste in the field "Map API Key" the API key and click on "Save". If you now go back to the "Earthquake Service" page, the map should load (if not, try refreshing the entire page).
How does this map get populated? If you go in "House" / "Sensors" you will notice a new sensor created by the package upon installation which is polling periodically earthquake information from the usgs.gov service:
In case the earthquake has magnitude more than 5, it will be displayed in the map:
But how can we be alerted whenever a new earthquake took place? Let's create a brand new rule for this. Let's to to "House" / "Rules" and create a new rule.
In the "General" tab, give the rule an identifier of your choice, in the rule text write down the alert text using the placeholders from the variables defined later, set "alert" as severity, "realtime" as rule type (the rule will be evaluated as a new earthquake is stored in the sensor data store.
In the "Triggers" tab, add the sensor identifier the rule will monitor to trigger whenever a new value is set:
In the "Constants" tab set the threshold you want to set for the alert to trigger. E.g. even if the map is displaying any earthquake with a magnitude greater than 5, we want to be alerted with magnitude 7 or above:
In the "Variables" tab, we need to get from the sensor the information we need for then articulating our conditions and/or for our alert message. Specifically we need the magnitude of the latest earthquake, the distance from our house and the location where it took place. For this we are leveraging the special function DISTANCE, POSITION_LABEL and POSITION_TEXT which are extracting out of a location data type the required data:
In the "Conditions" tab, we add a single condition, e.g. when the magnitude of the earthquake is above the given threshold:
If we want to be alerted if the earthquake only took place nearby our house, we can define a new constant called e.g. max_distance and then set an additional condition like distance < max_distance. Remember any distance is calculated from the location of your house set in "House" / "Settings".
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
[This post has been migrated from the old forum, it was originally sent by user2684 on 2020-06-29 10:43:13]
eGeoffrey is capable of handling a number of diverse information among those, positions on a map. Let's work on a earthquake use case today. As always, let's search the marketplace first:
Install the package:
and start it:
If we now connect back to eGeoffrey web interface, we notice a menu item called "Earthquake Service" under the section "Examples". If we click on it, we get a map with a "Ops something went wrong error message". This is because we need a Google Maps API key for making this map (and any other map in eGeofrey working fine.
To do so, let's go to https://developers.google.com/maps/documentation/embed/get-api-key and get an API key. Once done, go back to eGeoffrey, go to "House" / "Settings" and under the "Web Interface" tab let's paste in the field "Map API Key" the API key and click on "Save". If you now go back to the "Earthquake Service" page, the map should load (if not, try refreshing the entire page).
How does this map get populated? If you go in "House" / "Sensors" you will notice a new sensor created by the package upon installation which is polling periodically earthquake information from the usgs.gov service:
In case the earthquake has magnitude more than 5, it will be displayed in the map:
But how can we be alerted whenever a new earthquake took place? Let's create a brand new rule for this. Let's to to "House" / "Rules" and create a new rule.
DISTANCE
,POSITION_LABEL
andPOSITION_TEXT
which are extracting out of a location data type the required data:If we want to be alerted if the earthquake only took place nearby our house, we can define a new constant called e.g.
max_distance
and then set an additional condition likedistance < max_distance
. Remember any distance is calculated from the location of your house set in "House" / "Settings".Beta Was this translation helpful? Give feedback.
All reactions