- Properties:
 - Methods:
- getFields()
 - getFieldStats(field_id, options)
 - getFieldUniqueValues(field_id, options)
 - getFieldUniqueValuesCount(field_id, options)
 - getSettings()
 - updateSettings(options)
 - getTilejson()
 - getFeature(feature_id)
 - getFeatures(option)
 - createFeature(geojson)
 - deleteFeature(feature_id)
 - deleteFeatures(feature_ids)
 - updateFeature(feature_id, geojson)
 - updateFeatureGeometry(feature_id, options)
 - updateFeatureProps(feature_id, options)
 - updateFeaturePropsAndGeometry(feature_id, properties_options, geometry_options)
 - seedCache(options)
 - getCacheSize()
 - clearCache()
 - importFile(options)
 - export(options)
 
 
Tip: After you access the vector layer view object, the following methods and properties are applicable on the vector layer view.
Properties:
uuid
Returns the universally unique identifier (UUID) of the vector layer view.
Returns:
uuid: Returns uuid string.
Example:
const vectorLayerViewUuid = vectorLayerView.uuid;
name
Returns the name of the vector layer view.
Returns:
String: Returns name of vector layer view.
Example:
const vectorLayerViewName = vectorLayerView.name;
display_name
Returns the display name of the vector layer view.
Returns:
String: Returns display name of vector layer view.
Example:
const vectorLayerViewDisplayName = vectorLayerView.display_name;
description
Returns the description of the vector layer view.
Returns:
String: Returns vector layer view description.
Example:
const vectorLayerViewDescription = vectorLayerView.description;
created_at
Returns the time and date that the vector layer view was created.
Returns:
Date: Returns vector layer view created time.
Example:
const vectorLayerViewCreatedTime = vectorLayerView.created_at;
last_edit_at
Returns the time and date that the vector layer view is updated.
Returns:
Date: Returns vector layer view updated time.
Example:
const vectorLayerViewModifiedTime = vectorLayerView.last_edit_at;
is_shared
Indicates whether the vector layer view is shared or not.
Returns:
Boolean: If true, vector layer view is shared.
Example:
const isShared = vectorLayerView.is_shared;
is_view
For vector layer view, this parameter is always true.
Returns:
Boolean: For vector layer view, this parameter always is true.
Example:
const isView = vectorLayerView.is_view;
has_z
Indicates whether the vector layer view geometry is 3D or not.
Returns:
Boolean: If true, vector layer view geometry is 3D and has z value.
Example:
const hasZ = vectorLayerView.has_z;
id
Returns the vector layer view id.
Returns:
Number: Returns vector layer view id.
Example:
const vectorLayerViewId = vectorLayerView.id;
owner_id
Returns the user ID that the vector layer view belongs to.
Returns:
Number: Returns vector layer view owner id.
Example:
const vectorLayerViewOwnerId = vectorLayerView.owner_id;
layer_type
Returns the type of geometry of the vector layer view.
Returns:
String: Returns geometry type of vector layer view.
Example:
const vectorLayerViewType = vectorLayerView.layer_type;
layer_settings
Returns the vector layer view settings. This parameter has a value if include_settings is true at the time of getting vector layer view.
Returns:
Object: Returns settings object.
Example:
const layerSettings = vectorLayerView.layer_settings;
extent
Returns the coordinates of the vector layer view extent in the Web Mercator coordinate system.
Returns:
Array: Returns an array contains [southwest x, southwest y, northeast x, northeast y].
Example:
const viewExtent = vectorLayerView.extent;
feature_count
Returns the number of features in the vector layer view.
Returns:
Number: Returns count of features.
Example:
const featureCount = vectorLayerView.feature_count;
vector_layer
Returns the descriptive information of the source vector layer.
Returns:
Object: Returns object of vector layer.
Example:
const vectorLayerInfo = await vectorLayerView.vector_layer;
view_cols
Returns the fields of the vector layer view.
Returns:
Object: Returns object of vector layer view fields.
Example:
const vectorLayerViewFields = await vectorLayerView.view_cols;
view_filter
Returns the filter which the vector layer view was constructed from the vector layer by that.
Returns:
String: Returns vector layer view filter.
Example:
const vectorLayerViewFilter = await vectorLayerView.view_filter;
Methods:
getFields()
Returns the vector layer view fields.
Returns:
Array: Returns an array of fields.
Example:
const fields = await vectorLayerView.getFields();
getFieldStats(field_id, options)
Returns the statistical parameters of the field, including the minimum value, the maximum value, and the average.
Parameters:
field_id is the id of an available field.
options (Object)
| Name | Description | 
|---|---|
| 
 options.func_type 
String 
 | 
choices are ‘min’ | ‘max’ | ‘avg’. | 
Returns:
String: Returns field statistic value.
Example:
const fieldStat = await vectorLayerView.getFieldStats(10,{func_type:'avg'});
getFieldUniqueValues(field_id, options)
Returns the unique values of the field.
Parameters:
field_id is the id of an available field.
options (Object)
| Name | Description | 
|---|---|
| 
 options.exclude_null 
Boolean 
defult: false 
 | 
If true, null values skipped. | 
| 
 options.skip 
Number? 
Default: 0 
 | 
Number of skipped unique values. | 
| 
 options.limit 
Number? 
Default:50 
 | 
Maximum number for result unique values.. | 
Returns:
Array: Returns an array of unique values.
Example:
const fieldUniqueValues = await vectorLayerView.getFieldUniqueValues(10);
getFieldUniqueValuesCount(field_id, options)
Returns the number of unique values of the field.
Parameters:
field_id is the id of an available field.
options (Object)
| Name | Description | 
|---|---|
| 
 options.exclude_null 
Boolean 
defult: false 
 | 
If true, null values skipped. | 
Returns:
Number: Returns count of unique values.
Example:
const fieldUniqueValuesCount = await vectorLayerView.getFieldUniqueValuesCount(10);
getSettings()
Returns the vector layer view settings.
Returns:
Object: Returns settings object.
Example:
const viewSettings = await vectorLayerView.getSettings();
updateSettings(options)
Updates the vector layer view settings.
Parameters:
options (Object)
| Name | Description | 
|---|---|
| 
 options.general_settings 
String 
 | 
e.g. { ‘title_field’: ‘name’} | 
| options.edit_settings
 String? 
 | 
e.g. {‘editable’: true, ‘edit_geometry’: true, ‘editable_attributes’: ‘[ALL]’, ‘allow_insert’: true, ‘allow_delete’: true} | 
| options.tile_settings
 String? 
 | 
e.g. {‘min_zoom’: 0, ‘max_zoom’: 22, ‘max_features’: 65536, ‘filter_features’: true, ‘fields’: [ ‘id’], ‘use_cache’: true, ‘cache_until_zoom’: 17} | 
Returns:
Object: Returns settings object.
Example:
const layerSettings = await vectorLayerView.updateSettings({
   'general_settings': {
      'title_field': 'name'
   },
   'edit_settings': {
      'editable': true,
      'edit_geometry': true,
      'editable_attributes': '[ALL]',
      'allow_insert': true,
      'allow_delete': true
   },
   'tile_settings': {
      'min_zoom': 0,
      'max_zoom': 22,
      'max_features': 65536,
      'filter_features': true,
      'fields': [
         'id'
      ],
      'use_cache': true,
      'cache_until_zoom': 17
   }
});
getTilejson()
Returns vector layer view tile information such as tile access address.
Returns:
Object: Returns an object that contains information of vector layer view tiles.
Example:
const viewTilejson = await vectorLayerView.getTilejson();
getFeature(feature_id)
Returns the GeoJSON of the desired feature of the vector layer view.
Parameters:
feature_id is the id of an available feature.
Returns:
Geojson: Returns geojson of feature.
Example:
const feature = await vectorLayerView.getFeature(1);
getFeatures(option)
Returns the GeoJSON of the desired features of the vector layer view.
Parameters:
options (Object)
| Name | Description | 
|---|---|
| 
 options.f 
String? 
Default: ‘json’ 
 | 
Output format. Choices are: ‘json’ | ‘topojson’ | ‘html’ | 
| 
 options.quant_factor 
Number? 
Default: 1000000 
 | 
Quantization factor. This parameter is only used by topojson encoder and is ignored for other formats. Higher quantizaion value means higher geometry precision. | 
| 
 options.skip 
Number? 
Default: 0 
 | 
Number of skipped features. | 
| 
 options.limit 
Number? 
Default:100 
 | 
Maximum number for result features. | 
| 
 options.search 
String 
 | 
search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.  | 
| 
 options.search_fields 
String? 
 | 
Comma separated list of fields for searching | 
| 
 options.skip_geometry 
Boolean? 
Default: false 
 | 
If true, output result does not have geometry. | 
| 
 options.return_count 
Boolean? 
Default: false 
 | 
if true, returns only the number of features that satisfy conditions. | 
| 
 options.feature_ids 
String? 
 | 
Comma separated list of feature ids which should be filtered. | 
| 
 options.select_fields 
String? 
Default: [ALL] 
 | 
 Comma separated field names which should be included to the result.  | 
| 
 options.skip_fields 
String? 
 | 
Comma separated field names which should be excluded from the result. | 
| options.out_srid
 String? 
Default: 3857 
 | 
Srid (epsg code) of result features. e.g. 4326 | 
| 
 options.order_by 
String? 
 | 
Comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, length D NOTE: “A” denotes ascending order and “D” denotes descending order.  | 
| options.q
 String 
 | 
Query filter based on OGC CQL standard. e.g. Name LIKE ‘%GIS%’ AND INTERSECTS(geometry, ‘SRID=3857;POLYGON((4901948 2885079, 7049893 2885079, 7049893 4833901, 4901948 4833901, 4901948 2885079))’)  | 
| 
 options.bbox 
Array? 
 | 
e.g. [50.275, 35.1195, 51.4459, 36.0416] | 
| 
 options.bbox_srid 
Number? 
Default: 3857 
 | 
Srid (epsg code) of bbox. e.g. 4326. | 
| 
 options.page 
Number? 
Default:1 
 | 
The minimum number of pages is 1. | 
| 
 options.page_size 
Number? 
Default:10 
 | 
The minimum number of features on each page is 1. | 
Returns:
Geojson: Returns geojson of features.
Example:
const features = await vectorLayerView.getFeatures({
   f: "json",
   q: `id=1`,
   out_srid: 4326,
   select_fields: ["id"]
})
createFeature(geojson)
Adds new feature to the source vector layer.
Returns:
Geojson: Returns created feature geojson.
Example:
const newFeature = await vectorLayerView.createFeature({
   'type': 'Feature',
   'geometry': {
      'type': 'Point',
      'coordinates': [5610214, 4215675],
   },
   'properties' : {'name':'tehran'}
})
deleteFeature(feature_id)
Deletes the desired feature from the source vector layer.
Parameters:
feature_id is the id of an available feature.
Returns:
String: Returns a message that shows deleting was successful or not. Null message means deleting was successful.
Example:
const result = await vectorLayerView.deleteFeature(10);
deleteFeatures(feature_ids)
Deletes the desired features from the source vector layer.
Parameters:
feature_ids is comma separated list of ids of features.
Returns:
String: Returns a message that shows deleting was successful or not. Null message means deleting was successful.
Example:
const result = await vectorLayerView.deleteFeatures([10,20]);
updateFeature(feature_id, geojson)
Updates the desired feature of the source vector layer.
Parameters:
feature_id is the id of an available feature.
Returns:
Geojson: Returns feature geojson.
Example:
const feature = await vectorLayerView.updateFeature(10,{
   'type': 'Feature',
   'geometry': {
      'type': 'Point',
      'coordinates': [5610214, 4215675],
   },
   'properties' = {'name':'tehran'}
})
updateFeatureGeometry(feature_id, options)
Updates the desired feature geometry of the source vector layer.
Parameters:
feature_id is the id of an available feature.
options (Object)
| Name | Description | 
|---|---|
| 
 options.type 
String 
 | 
Type of geometry. | 
| options.coordinates
 String? 
 | 
Array of coordinates. | 
Returns:
Geojson: Returns feature geojson.
Example:
const feature = await vectorLayerView.updateFeatureGeometry(10,{
   'type': 'Point',
   'coordinates': [5610214, 4215675],
})
updateFeatureProps(feature_id, options)
Updates the desired feature attributes of the source vector layer.
Parameters:
feature_id is the id of an available feature.
options (Object): object of fields and values.
Returns:
Geojson: Returns feature geojson.
Example:
const feature = await vectorLayerView.updateFeatureProps(10,{
   'name': 'tehran'
})
updateFeaturePropsAndGeometry(feature_id, properties_options, geometry_options)
Updates the desired feature geometry and attributes.
Parameters:
feature_id is the id of an available feature.
properties_options (Object): Object of fields and values.
geometry_options (Object)
| Name | Description | 
|---|---|
| 
 options.type 
String 
 | 
Type of geometry. | 
| options.coordinates
 String? 
 | 
Array of coordinates. | 
Returns:
Geojson: Returns feature geojson.
Example:
const feature = await vectorLayerView.updateFeaturePropsAndGeometry(10,
   {'name': 'tehran'},
   {'type': 'Point', 'coordinates': [5610214, 4215675]}
)
seedCache(options)
Generates and stores tiles for the existing vector layer view. See generating vector layer view for more guidance.
Parameters:
options (Object)
| Name | Description | 
|---|---|
| 
 options.from_zoom 
Number 
 | 
from_zoom parameter is between 0 and 22. | 
| 
 options.to_zoom 
Number 
 | 
to_zoom parameter is between 0 and 22. | 
| 
 options.ignore_cache 
Boolean 
default: true 
 | 
If true, ignore previous cache. | 
| 
 options.workers 
Number 
 | 
Number of cpu cores. | 
| 
 options.user_id 
Number? 
 | 
If the admin wants to build cache for a vector layer view of a certain user, this parameter determines which user is the target user. | 
Returns:
Object: Returns task id to manage task.
Example:
const taskId = await vectorLayerView.seedCache({
   'from_zoom': 0,
   'to_zoom': 2,
   'ignore_cache': true,
   'workers': 1,
   'user_id': 2
})
getCacheSize()
Returns the size of tiles generated and stored for vector layer view in bytes.
Returns:
Number: Returns tiles size in byte.
Example:
const tilesSize = await vectorLayerView.getCacheSize();
clearCache()
Removes generated tiles for the desired vector layer view.
Returns:
String: Returns a message that shows clearing was successful or not. Null message means clearing was successful.
Example:
const result = await vectorLayerView.clearCache();
importFile(options)
Imports file data to the source vector layer.
Parameters:
options (FormData)
| Name | Description | 
|---|---|
| 
 file_uuid 
String 
 | 
Universally unique identifier (UUID) of the file that is published in the geobox portal. | 
| 
 file_encoding 
String 
Deafult: ‘utf-8’ 
 | 
Encoding of the file. e.g. ‘utf-8’ | 
| 
 input_srid 
Number 
Deafult: 3857 
 | 
srid of the input layer | 
| 
 input_layer 
String 
 | 
Name of the layer that you want to import. | 
| 
 input_dataset 
String 
 | 
Name of the dataset that you want to import layer from. | 
| 
 input_geom_type 
String 
 | 
If there are multiple geometry type in the dataset, select the geometry type that you want to import. Choices are: ‘POINT’| ‘LINESTRING’| ‘POLYGON’| ‘MULTIPOINT’| ‘MULTILINESTRING’| ‘MULTIPOLYGON’| ‘POINTZ’| ‘LINESTRINGZ’| ‘POLYGONZ’| ‘MULTIPOINTZ’| ‘MULTILINESTRINGZ’| ‘MULTIPOLYGONZ’. | 
| 
 report_errors 
Boolean 
Default: false 
 | 
If true, errors will be reported. | 
| 
 user_id 
Number? 
 | 
If the admin wants to imports file to a vector layer of a certain user, this parameter determines which user is the target user. | 
Returns:
Object: Returns task id to manage task.
Example:
First, create a FormData. Then add the values.
let formData = new FormData();
formData.append('file_uuid', '4f9f3e4b-4dc1-469b-83ab-00ae00f02581');
formData.append('file_encoding', 'utf-8');
formData.append('input_srid', 3857);
formData.append('input_layer', 'province');
formData.append('input_geom_type', 'POLYGON');
const result = await vectorLayerView.importFile(formData);
export(options)
Exports the vector layer view to different formats.
Parameters:
options (FormData)
| Name | Description | 
|---|---|
| 
 out_format 
String 
 | 
Choices are: ‘Shapefile‘ | ‘GPKG’ | ‘GeoJSON’ | ‘CSV’ | ‘KML’ | ‘DXF’. | 
| 
 out_srid 
Number 
Deafult: 3857 
 | 
srid of output layer. | 
| 
 q 
String? 
 | 
Query filter based on OGC CQL standard. e.g. “field1 LIKE ‘%GIS%’ AND created_at > ‘2021-01-01′”  | 
| 
 bbox 
Array? 
 | 
[southwest x, southwest y, northeast x, northeast y] | 
| 
 bbox_srid 
Number 
Deafult: 3857 
 | 
srid of bounding box | 
| 
 feature_ids 
Array? 
 | 
Comma separated list of ids for searching | 
| 
 fields 
Array? 
 | 
Comma separated list of fields for searching | 
| 
 zipped 
Boolean 
Default: false 
 | 
If true, the output is compressed. | 
| 
 run_async 
Boolean 
Default: true 
 | 
If true, the process will be doing as a task, otherwise object will be returned directly. | 
Returns:
Object: Returns task id to manage task.
Example:
First, create a FormData. Then add the values.
let formData = new FormData();
formData.append('out_format', 'Shapefile');
formData.append('out_srid', 4326);
formData.append('zipped', true);
const outputResult = await vectorLayerView.export(formData);
After completing the desired task, use getTask to access the task information, which also includes the file download link.