update_zone

The update_zone function is used to create, edit, or delete geofences.

Copied!
svc=resource/update_zone&params={"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

NameDescription
itemIdResource ID.
idGeofence ID (0 — create).
callModeAction: create, update, delete, reset_image.
oldItemIdThe ID of the resource from which the geofence should be copied.
oldZoneIdThe ID of the geofence which should be copied.
nName.
dDescription.
t

Geofence type: 

  • 1 — line;
  • 2 — polygon;
  • 3 — circle.
wLine width.
fFlags (see below).
cColour.
tcText colour.
tsText size.
minMinimum scale (visibility from).
maxMaximum scale (visibility to).
pathIcon path.
lindIdIcon library ID.
jpCustom fields in the name:value format.
pPoints, where "r" is the radius.

The other parameters are only required to create and to edit geofences. Read more on the get_zone_data page.

Flags:

FlagDescription
0х1Address.
0x2The beginning of the trip.
0x4The end of the trip.
0x10Float.
0x20Show shape.
0x40Skip the simplification.

Returned result

For creation and modification requests:

Copied!
[
	<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, 0ID 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:

Copied!
[
	<long>,		/* geofence ID */
	null
]

Possible error codes:

CodeDescription
7Failed 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.
6Undefined error.
4Wrong input parameters.
Download PDF file
Download Word document

See also