update_zone
The update_zone function is used to create, edit, or delete geofences.
svc=resource/update_zone¶ms={"itemId":<long>,
"id":<long>,
"callMode":"<text>",
"n":"<text>",
"d":"<text>",
"t":<int>,
"w":<int>,
"f":<uint>,
"c":<int>,
"tc":<uint>,
"ts":<uint>,
"min":<uint>,
"max":<uint>,
"path":"<text>",
"libId":<long>,
"oldItemId":<uint>,
"oldZoneId":<uint>,
"jp":<JSON>,
"p":[
{
"x":<double>,
"y":<double>,
"r":<int>
}
]}
Parameters
Name | Description |
---|---|
itemId | Resource ID. |
id | Geofence ID (0 — create). |
callMode | Action: create, update, delete, reset_image. |
oldItemId | The ID of the resource from which the geofence should be copied. |
oldZoneId | The ID of the geofence which should be copied. |
n | Name. |
d | Description. |
t | Geofence type:
|
w | Line width. |
f | Flags (see below). |
c | Colour. |
tc | Text colour. |
ts | Text size. |
min | Minimum scale (visibility from). |
max | Maximum scale (visibility to). |
path | Icon path. |
lindId | Icon library ID. |
jp | Custom fields in the name:value format. |
p | Points, where "r" is the radius. |
If you want to copy (and to edit at the same time) a geofence, use the oldItemId and oldZoneId parameters to indicate it.
The other parameters are only required to create and to edit geofences. Read more on the get_zone_data page.
Flags:
Flag | Description |
---|---|
0х1 | Address. |
0x2 | The beginning of the trip. |
0x4 | The end of the trip. |
0x10 | Float. |
0x20 | Show shape. |
0x40 | Skip the simplification. |
Returned result
For creation and modification requests:
[
<long>, /* geofence ID */
{
"n":"<text>", /* name */
"d":"<text>", /* description */
"id":<long>, /* geofence ID */
"f":<uint>, /* flags */
"t":<int>, /* type: 1 — line, 2 — polygon, 3 — circle */
"e":<ushort> /* check sum (CRC16) */
"c":<uint>, /* RGB colour */
"i":<ushort>, /* check sum of image (CRC16) */
"icon":"<text>", /* icon image URI */
"path":"<text>", /* short path to default icon */
"libId":<long>, /* ID of the icon library, 0 — ID of the default icon library */
"w":<int>, /* line width */
"b":{ /* configuration for rendering */
"min_x":<double>, /* minimum longitude */
"min_y":<double>, /* minimum latitude */
"max_x":<double>, /* maximum longitude */
"max_y":<double>, /* maximum latitude */
"cen_x":<double>, /* the longitude of the centre */
"cen_y":<double> /* the latitude of the centre */
},
"ct":<uint>, /* creation time */
"mt":<uint>, /* last modification time */
"jp":<JSON> /* custom JSON */
}
]
The geofence flags are described on the get_zone_data page.
For deletion requests:
[
<long>, /* geofence ID */
null
]
Possible error codes:
Code | Description |
---|---|
7 | Failed to fetch the item with the desired ACL (ADF_ACL_AVL_RES_EDIT_ZONES or ADF_ACL_AVL_RES_VIEW_ZONES) or item/zone with the old_id not found. |
6 | Undefined error. |
4 | Wrong input parameters. |