-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Problem description
Additionally to circles the Geofencing API should support polygon type areas. Circle type is rarely used as geofence. Usually a geofence describes a shape of an (often human built) geographical object like factories, buildings, city and country areas.
Possible evolution
Add polygon areas. The new datatype can be based on Geojson scheme (sorted array of 3DPoint-s) but using 2D geo type Point.
Minimal number of points in the array is naturally set to 3. Maximal number can be restricted to 16 in order to avoid possible performance issues when calculating intersections between location area and geofence for triggering entering/leaving events.
The array of geo points can be non-closed (first and last point are meant to be connected by last edge and should not be the same point) and required to be sorted. In this case the implementation should validate the polygon for edge intersections.
AreaType:
type: string
description: |
Type of this area.
CIRCLE - The area is defined as a circle.
POLYGON - The area is defined as polygon.
enum:
- CIRCLE
- POLYGON
...
Polygon:
description: Polygon based area defined by an ordered geo points array
type: object
allOf:
- $ref: "#/components/schemas/Area"
- type: object
properties:
coordinates:
type: array
items:
type: array
items:
$ref: "#/components/schemas/Point"
minItems: 3
maxItems: 16
example:
areaType: POLYGON
coordinates:
- latitude: 52.516770
longitude: 13.378156
- latitude: 52.516841
longitude: 13.379433
- latitude: 52.515917
longitude: 13.37959
- latitude: 52.515849
longitude: 13.378308