Creating circle Geofence with radius via REST API

Hello,

We are going through the documentation of Cumulocity REST API, but cannot find information on how to create circular Geofence (with radius defined) and also to create alarm on Boundary exit.

We somehow managed to find out how to create polygon Geofence with

 POST /service/smartrule/managedObjects/{{managedObjectId}}/smartrules
{
	"type": "c8y_PrivateSmartRule",
	"name": "Test",
	"enabled": true,
	"config": {
		"geofence": [
			{
				"lat": 44.84135569856291,
				"lng": 20.41612207889557
			},
			{
				"lat": 44.84213925640641,
				"lng": 20.417162775993344
			},
			{
				"lat": 44.84126440957738,
				"lng": 20.417720675468445
			},
			{
				"lat": 44.84109704606153,
				"lng": 20.41633665561676
			}
		],
		"triggerAlarmOn": "both",
		"alarmType": "c8y_GeofenceAlarm",
		"alarmSeverity": "CRITICAL",
		"alarmText": "Geofence"
	},
	"c8y_Context": {
		"context": "device",
		"id": "1111"
	},
	"ruleTemplateName": "onGeofenceCreateAlarm",
	"enabledSources": [
		"1111"
	]
}

Can you assist with any examples?

Kind regards,
Miloš

Hi Miloš,

Smart Rules only support the creation of geofences using polygons. There aren’t any Smart Rules available for circular geofences and creating alarms if a boundary exit event occurs. This behavior would require a custom implementation:

  • create UI plugin or widget to create circular geofence rules and manage these
  • create dedicated Apama EPL monitor which processes location events and checks whether they apply to a specific circular geofence rule

I don’t have any examples available for this specific use case.

Best regards
Christian

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.