Methods:
createTileset(options)
Creates new tileset. This function is an asynchronous function.
Parameters:
options (Object)
Name | Description |
---|---|
options.name
String
|
Name of new tileset. |
options.display_name
String?
|
Display name of new tileset. This parameter is helpful in identifying tileset easily. |
options.description
String?
|
Description of tileset. |
options.min_zoom
Number?
|
Minimum zoom can be a number between 0 and 22. |
options.max_zoom
Number?
|
Maximum zoom can be a number between 0 and 22. |
options.layers
Array
|
Array of layers that you want to add to tileset. This array contains objects with layer_type and layer_uuid. |
options.user_id
Number?
|
If the admin wants to create tileset for a certain user, this parameter determines which user is the target user. |
Returns:
Tileset: Returns itself to allow for method chaining.
Example:
const newTileset = await Server.createTileset({ 'name': 'string', 'display_name': 'string', 'description': 'string', 'min_zoom': 0, 'max_zoom': 22, 'layers': [ {'layer_type': 'vector', 'layer_uuid': '4f9f3e4b-4dc1-469b-83ab-00ae00f02581' }, {'layer_type': 'view', 'layer_uuid': '4f9f3e4b-4dc1-469b-83ab-00ae00f02581' } ], 'user_id': 0 });
updateTileset(tileset_uuid, options)
Updates the existing tileset. This function is an asynchronous function.
Parameters:
tileset_uuid is the available tileset uuid.
options (Object)
Name | Description |
---|---|
options.name
String
|
Name of tileset. |
options.display_name
String?
|
Display name of tileset. This parameter is helpful in identifying tileset easily. |
options.description
String?
|
Description of tileset. |
options.min_zoom
Number?
|
Minimum zoom can be a number between 0 and 22. |
options.max_zoom
Number?
|
Maximum zoom can be a number between 0 and 22. |
Returns:
Tileset: Returns itself to allow for method chaining.
Example:
const tileset = await Server.updateTileset({ 'name': 'string', 'display_name': 'string', 'description': 'string', 'min_zoom': 0, 'max_zoom': 22 });
getTileset(tileset_uuid)
Returns the desired existing tileset. This function is an asynchronous function.
Parameters:
tileset_uuid is the available tileset uuid.
Returns:
Tileset: Returns itself to allow for method chaining.
Example:
const tileset = await Server.getTileset('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');
getTilesetsByIds(options)
Returns the desired existing tilesets. This function is an asynchronous function.
Parameters:
options (Object)
Name | Description |
---|---|
options.ids
Number | Array
|
Ids of tilesets. If you want a single tileset, insert id as a string. |
options.user_id
Number?
|
If the admin wants to fetch tilesets of a certain user, this parameter determines which user is the target user. |
Returns:
Array: Returns an array of tilesets.
Example:
const tilesets = await Server.getTilesetsByIds({ 'ids': [25,125], 'user_id' :0 });
getTilesetByName(name, user_id)
Returns the desired existing tileset. This function is an asynchronous function.
Parameters:
name is the available tileset name.
user_id is the id of the user that tileset belongs to.
Returns:
Tileset: Returns itself to allow for method chaining.
Example:
const tileset = await Server.getTilesetByName('city',2);
getTilesets(options)
Returns the desired existing tilesets. This function is an asynchronous function.
Parameters:
options (Object)
Name | Description |
---|---|
options.f
String
defult: ‘json’
|
Output format. Choices are: ‘json’ | ‘html’ |
options.q
String?
|
Query filter based on OGC CQL standard. e.g. “field1 LIKE ‘%GIS%’ AND created_at > ‘2021-01-01′” |
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.order_by
String?
|
Comma seperated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D NOTE: “A” denotes ascending order and “D” denotes descending order. |
options.skip
Number?
Default: 0
|
Number of skipped tilesets. |
options.limit
Number?
Default:10
|
Maximum number for result tilesets. |
options.user_id
Number?
|
If the admin wants to fetch tilesets of a certain user, this parameter determines which user is the target user. |
options.shared
Bolean
default: false
|
If true, returns only the tilesets that are shared. |
options.page
Number?
Default:1
|
The minimum number of pages is 1. |
options.page_size
Number?
Default:10
|
The minimum number of maps on each page is 1. |
Returns:
Array: Returns an array of tilesets.
Example:
const tilesets = await Server.getTilesets({q:`name = 'string'`,user_id :0});
deleteTileset(tileset_uuid)
Deletes the desired existing tileset.
Parameters:
tileset_uuid is the available tileset uuid.
Returns:
String: Returns a message that shows deleting was successful or not. Null message means deleting was successful.
Example:
const result = await Server.deleteTileset('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');
seedCacheTileset(tileset_uuid, options)
Generates and stores tiles for the existing tileset. See generating and storing tiles for more guidance.
Parameters:
tileset_uuid is the available tileset uuid.
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.extent
Array
|
[southwest x, southwest y, northeast x, northeast y] |
options.workers
Number
|
Number of cpu cores. |
options.user_id
Number?
|
If the admin wants to build cache for a tileset 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 Server.seedCacheTileset('4f9f3e4b-4dc1-469b-83ab-00ae00f02581',{ 'from_zoom': 0, 'to_zoom': 2, 'extent': [51, 35, 52, 36], 'workers': 1, 'user_id': 2 })
getCacheSizeTileset(tileset_uuid)
Returns the size of tiles generated and stored for tileset in bytes.
Parameters:
tileset_uuid is the available tileset uuid.
Returns:
Number: Returns tiles size in byte.
Example:
const tilesSize = await Server.getCacheSizeTileset('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');
clearCacheTileset(tileset_uuid)
Removes generated tiles for the desired tileset.
Parameters:
tileset_uuid is the available tileset uuid.
Returns:
String: Returns a message that shows clearing was successful or not. Null message means clearing was successful.
Example:
const result = await Server.clearCacheTileset('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');