Methods:

createMap(options)

Creates a new map. This function is an asynchronous function.

Parameters:

options (Object)

Name Description
options.name
String
Name of new map.
options.display_name
String?
Display name of new map. This parameter is helpful in identifying maps easily.
options.description
String?
Description of map.
options.user_id
Number?
If the admin wants to create a new map for a certain user, this parameter determines which user is the target user.
options.extent
Array?
[[‘south west’][‘lng’], [‘south west’][‘lat’], [‘north east’][‘lng’],[‘north east’][‘lat’]]
options.thumbnail
String?
Base64 image URL.
options.style
Object?
{ version: <“version number here”>, sources: {}, layers: []}

Returns:

Map: Returns itself to allow for method chaining.

Example:

const newMap = await Server.createMap({
   'name': 'string',
   'display_name' : 'string',
   'user_id' : 0,
   'extent': [51, 35, 52,36],
   'thumbnail': 'string',
   'style': {version: 0, sources: {}, layers: []}
});

updateMap(map_uuid, options)

Updates the existing map. This function is an asynchronous function.

Parameters:

map_uuid is the available map uuid.

options (Object)

Name Description
options.name
String?
Name of map.
options.display_name
String?
Display name of map.
options.description
String?
Description of map.
options.extent
Array?
[[‘south west’][‘lng’], [‘south west’][‘lat’], [‘north east’][‘lng’],[‘north east’][‘lat’]]
options.thumbnail
String?
Base64 image URL.
options.style
Object?
{ version: <“version number here”>, sources: {}, layers: []}

Returns:

Map: Returns itself to allow for method chaining.

Example:

const map = await Server.updateMap('4f9f3e4b-4dc1-469b-83ab-00ae00f02581',{
   'name': 'string',
   'display_name' : 'string',
   'extent': [51, 35, 52, 36],
   'thumbnail': 'string',
   'style': {version: 0, sources: {}, layers: []}
});

deleteMap(map_uuid)

Deletes the existing map. This function is an asynchronous function.

Parameters:

map_uuid is the available map uuid.

Returns:

String: Returns a message that show deleting was successful or not. Null message means deleting was successful.

Example:

const result = await Server.deleteMap('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');

getMap(map_uuid)

Returns the desired existing map. This function is an asynchronous function.

Parameters:

map_uuid is the available map uuid.

Returns:

Map: Returns map object to allow for method chaining.

Example:

const map = await Server.getMap('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');

getMaps(options)

Returns the desired existing maps. 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 separated 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 maps.
options.limit
Number?
Default:10
Maximum number for result maps.
options.user_id
Number?
If the admin wants to fetch maps of a certain user, this parameter determines which user is the target user.
options.shared
Bolean
default: false
If true, returns only the maps 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:

Map: Returns map object to allow for method chaining.

Example:

const maps = await Server.getMaps({
   order_by: "created_at D",
   user_id: 0,
   search: 'string',
   shared:true,
   limit: 10
});

seedCacheMap(map_uuid, options)

Generates and stores tiles for the desired existing map. See generating and storing tiles for more guidance.

Parameters:

map_uuid is the available map 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
[[‘south west’][‘lng’], [‘south west’][‘lat’], [‘north east’][‘lng’],[‘north east’][‘lat’]]
options.workers
Number
Number of cpu cores.
options.user_id
Number?
If the admin wants to build cache for a map of a certain user, this parameter determines which user is the target user.
options.scale
Number
Default: null
Choices are: 1, 2, or null (null here means both)

Returns:

Object: Returns task id to manage task.

Example:

const taskId = await Server.seedCacheMap('4f9f3e4b-4dc1-469b-83ab-00ae00f02581',{
   'from_zoom': 0,
   'to_zoom': 2,
   'extent': [51, 35, 52, 36],
   'workers': 1,
   'user_id': 2,
   'scale': 2
})

getCacheSizeMap(map_uuid)

Returns the size of tiles generated and stored for the desired map in bytes.

Parameters:

map_uuid is the available map uuid.

Returns:

Number: Returns tiles size in byte.

Example:

const tilesSize = await Server.getCacheSizeMap('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');

clearCacheMap(map_uuid)

Removes generated tiles for the desired map.

Parameters:

map_uuid is the available map uuid.

Returns:

String: Returns a message that shows clearing was successful or not. Null message means clearing was successful.

Example:

const result = await Server.clearCacheMap('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');

Leave a comment

Your email address will not be published. Required fields are marked *