get_zone_data
To get detailed information about geofences, use the resource/get_zone_data method.
Endpoint
svc=resource/get_zone_data¶ms={
"itemId": <long>,
"col": [<long>],
"flags": <uint>
}
Parameters
Only the itemId parameter is required.
| Parameter | Description |
|---|---|
itemId |
Resource ID. |
col |
Array of geofence IDs. Optional. If it isn’t specified, the method returns all geofences of the resource. If an empty array is specified, the method returns an empty array. IDs of geofences that don’t exist in the resource are skipped without an error. |
flags |
Flags that determine the format of the returned JSON (see below). Optional. The default value is 0x1C. It’s also used if the value is 0 or isn’t an unsigned integer (for example, -1). |
The following flag values are available:
| Value | Description |
|---|---|
0x01 |
Area. |
0x02 |
Perimeter. |
0x04 |
The coordinates of the center and the limits of the geofence. |
0x08 |
All points. |
0x10 |
Basic properties. |
The id, ct, and mt fields are returned with any flags.
Response
If the request is completed successfully, the response is returned in the following format:
[ /* the array with data about geofences */
{
"n": "<text>", /* geofence name */
"d": "<text>", /* description */
"id": <long>, /* geofence ID in the resource/account */
"rid": <long>, /* resource/account ID */
"t": <byte>, /* type: 1 (line), 2 (polygon), 3 (circle) */
"w": <uint>, /* line thickness or circle radius (see the units below) */
"f": <uint>, /* geofence flags (see below) */
"c": <uint>, /* color (ARGB) */
"tc": <uint>, /* text color (RGB) */
"ts": <uint>, /* font size */
"min": <uint>, /* show on map starting with this zoom */
"max": <uint>, /* show on map until this zoom */
"i": <uint>, /* the checksum of the image (CRC32); 4294967295 if the geofence has no image */
"icon": "<text>", /* geofence image URI; returned only if the geofence has an image */
"path": "<text>", /* short path to the icon from the icon library; empty if the geofence has no such icon */
"ar": <double>, /* area (see the units below) */
"pr": <double>, /* perimeter (see the units below) */
"libId": <long>, /* icon library ID (0 for the default icon library) */
"jp": <JSON>, /* custom JSON; returned only if it's specified for the geofence */
"b": { /* limits */
"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 center */
"cen_y": <double> /* the latitude of the center */
},
"p": [ /* the array of geofence points */
{
"x": <double>, /* longitude */
"y": <double>, /* latitude */
"r": <uint> /* radius (see the units below) */
},
...
],
"ct": <uint>, /* creation time */
"mt": <uint> /* the previous modification time */
},
...
]
The units of w, r, ar, and pr depend on the measurement system of the resource. If it’s US or imperial, the values are in feet (w, r, pr) and square feet (ar). Otherwise, they’re in meters and square meters.
Geofence flags (f):
| Value | Description |
|---|---|
0x2 |
Geofence where a ride begins. It’s used in reports if the start and end geofences of rides aren’t specified in the table settings. |
0x4 |
Geofence where a ride ends. It’s used in reports if the start and end geofences of rides aren’t specified in the table settings. |
0x10 |
Set automatically when the geofence is saved. |
0x20 |
Show shape. |
0x40 |
Don’t simplify the geofence. |
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Wrong input parameters. |
| 7 | The item with the specified ID doesn’t exist or isn’t a resource, or the user has no View geofences access right to the resource. |