Skip to content

Commit 2725de2

Browse files
authored
Backport rules GeoJSON predicate to 1.12.x (#123)
1 parent 3cb6359 commit 2725de2

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# GeoJSON Geofencing in OpenRemote Rules
2+
3+
This document describes how to use GeoJSON geofencing within OpenRemote Rules to create location-based triggers and actions. GeoJSON geofencing allows you to define complex geographical areas using the GeoJSON format and trigger rules based on whether an asset is located within or outside these areas.
4+
5+
This feature is great for setting complex geofences that go beyond simple circular or rectangular shapes, enabling more precise location-based automation. Think of the borders of a given country, state, or city, or any custom-defined area where assets need to remain in, or out of.
6+
7+
## Using GeoJSON Geofencing in OpenRemote
8+
9+
To use GeoJSON geofencing in OpenRemote, follow these steps:
10+
11+
1. **Define your GeoJSON area:** Create a GeoJSON object representing the geographic area you want to use as a geofence. You can use online tools like [geojson.io](https://geojson.io/) to draw and export GeoJSON geometries.
12+
13+
2. **Create or edit a rule:** In the OpenRemote console, navigate to the Rules page and create a new when-then rule, or edit an existing one.
14+
15+
3. **Select an asset and attribute:** In the "when" section, select an asset and attribute that will be used to filter the rule execution.
16+
17+
4. **Configure the GeoJSON Geofence:**
18+
19+
* Select either "inside area" or "outside area" for the operator.
20+
* In the configuration panel, click the "GeoJSON" button and paste your GeoJSON into the text field. The UI provides validation tools to help with this.
21+
22+
5. **Define Then-actions:** Specify the actions to be performed in the then-section when the geofence condition (inside or outside the area) is met.
23+
24+
## Example
25+
26+
Here’s an example of a GeoJSON Polygon, around the area of the Rotterdam default map:
27+
28+
```json
29+
{
30+
"type": "FeatureCollection",
31+
"features": [
32+
{
33+
"type": "Feature",
34+
"properties": {},
35+
"geometry": {
36+
"coordinates": [
37+
[
38+
[
39+
4.48556382778753,
40+
51.91779377518452
41+
],
42+
[
43+
4.479700876335301,
44+
51.91779377518452
45+
],
46+
[
47+
4.479700876335301,
48+
51.91514625782321
49+
],
50+
[
51+
4.48556382778753,
52+
51.91514625782321
53+
],
54+
[
55+
4.48556382778753,
56+
51.91779377518452
57+
]
58+
]
59+
],
60+
"type": "Polygon"
61+
}
62+
}
63+
]
64+
}
65+
```
66+
67+
This Polygon defines a simple rectangular area. You can use more complex polygons, MultiPolygons, Features, or FeatureCollections to define more intricate geofences. You can input the same GeoJSON as custom GeoJSON styling in "Appearance -> Map Settings -> GeoJSON", to see the same area highlighted on the various OpenRemote maps.

0 commit comments

Comments
 (0)