
REST API, Service version 1.0.0
Geo-fencing service#
A geo-fence is a virtual perimeter for a real-world geographic area. A geo-fence could be dynamically generated-as in a radius around a point location, or a geo-fence can be a predefined set of boundaries (such as school zones or neighborhood boundaries).
For more details: Wikipedia
Summary#
- Request
- Mandatory parameters
- Optional parameters
- Response
- Details of fields
- Response samples
Request#
The request must be sent with the HTTP method POST and the HTTP header Content-Type set to application/json.
Sample:
URI: /bgis/service/geofencing/1.0
POST data:
{
"fenceShapes": [
{
"id": "1",
"type": "CIRCLE",
"center": {
"lon": 7.42806,
"lat": 43.75272
},
"radius": 3000
}
],
"positionType": "POLYGON",
"positions": [
{
"lon": 7.41888,
"lat": 43.73252
},
{
"lon": 7.41806,
"lat": 43.73272
},
{
"lon": 7.41537,
"lat": 43.73169
},
{
"lon": 7.41516,
"lat": 43.73184
},
{
"lon": 7.41461,
"lat": 43.73224
}
]
}All coordinates are defined by longitude and latitude, see the coordinate system glossary for more details.
Parameters#
fenceShapesGeoFenceShp[]requiredDefine a fence shape to perform a intersection test between the route and fence.
GeoFenceShp fields
centerCoordinaterequiredCenter of circle fence.
radiusinteger (int64)requiredRadius of circle fence.
verticesCoordinate[]requiredVertices of polygon fence.
idinteger (int64)The fence id. If value is negative the server will set it with an auto-incrementing number.
typeenumDefine the type of geometric shape of fence, like CIRCLE or POLYGON.
2 accepted values
CIRCLECircle. POLYGONPolygon.
positionsGeofencingPos[]requiredThe coordinates will be compared with the fences.
geoserverstringGeoserver name.
swidxinteger (int32)deprecatedSwitch index.
positionTypeenumDefine type of
positionsparameter used to perform a comparison between fence shapes and coordinates.3 accepted values
CIRCLEDefine type of xy parameter as circle to perform a comparison between fence shapes and a circle. POLYLINEDefine the interpretation of coordinates of xy parameter to perform a comparison between fence shapes and a polyline. POLYGONDefine the interpretation of coordinates of xy parameter to perform a comparison between fence shapes and a polygon. optionsenum[]Comma-separated list of one or more geo-fencing options.
1 accepted value
SEARCHEnable to search the fences with coordinate, in this case the parameter positionscan be use the radius.
Response#
Return a list in same order of xy parameters (list of coordinates) with state INSIDE, OUTSIDE or INTERSECT.
Result of compare test#
- positionStates: The status of result. Available values below.
| Values | Illustration | Description |
|---|---|---|
INSIDE | Defines if the tested coordinate is in fence. | |
OUTSIDE | Defines if the tested coordinate is out of fence. | |
INTERSECT | Position is not completely inside or outside but the shapes are intersected. |
Details of fields#
fenceResultsGeofencingRes[]Return a list in same order of xy parameters (list of coordinates) with state INSIDE, OUTSIDE or INTERSECT.
GeofencingRes fields
idinteger (int64)Unique ID of fence.
typeenumType of geometry.
2 accepted values
CIRCLECircle. POLYGONPolygon. fenceShapeGeoFenceShpShape of fence used to perform the test.
GeoFenceShp fields
centerCoordinaterequiredCenter of circle fence.
radiusinteger (int64)requiredRadius of circle fence.
verticesCoordinate[]requiredVertices of polygon fence.
idinteger (int64)The fence id. If value is negative the server will set it with an auto-incrementing number.
typeenumDefine the type of geometric shape of fence, like CIRCLE or POLYGON.
2 accepted values
CIRCLECircle. POLYGONPolygon.
positionStatesenum[]Defines position state of tested coordinate on the fence geometry.
5 accepted values
INWARDDefines if the tested coordinate is an inward intersection. INSIDEDefines if the tested coordinate is in fence. OUTWARDDefines if the tested coordinate is an outward intersection. OUTSIDEDefines if the tested coordinate is out of fence. INTERSECTPosition is not completely inside or outside but the shapes are intersected.
Response samples#
JSON Sample:
{
"fenceResults": [
{
"id": 1,
"type": "CIRCLE",
"positionStates": [
"OUTSIDE"
]
}
]
}