Tip: After you access the map object, the following methods and properties are applicable on the map.
Properties:
uuid
Returns the universally unique identifier (UUID) of the map.
Returns:
uuid: Returns uuid string.
Example:
const mapUuid = map.uuid;
name
Returns the name of the map.
Returns:
String: Returns map name.
Example:
const mapName = map.name;
display_name
Returns the display name of the map.
Returns:
String: Returns map display name.
Example:
const mapDisplayName = map.display_name;
description
Returns the description of the map.
Returns:
String: Returns map description.
Example:
const mapDescription = map.description;
created_at
Returns the time and date that the map was created.
Returns:
Date: Returns map created time.
Example:
const mapCreatedTime = map.created_at;
last_modified_at
Returns the time and date that the map is updates.
Returns:
Date: Returns map updated time.
Example:
const mapModifiedTime = map.last_modified_at;
is_shared
Indicates whether the map is shared or not.
Returns:
Bolean: If true, map is shared.
Example:
const isShared = map.is_shared;
id
Returns the map id.
Returns:
Number: Returns map id.
Example:
const mapId = map.id;
owner_id
Returns the user ID that the map belongs to.
Returns:
Number: Returns map owner id.
Example:
const mapOwnerId = map.owner_id;
extent
Returns the coordinates of the map extent in the geographic coordinate system.
Returns:
Array: Returns an array includes [southwest lng, southwest lat, northeast lng, northeast lat].
Example:
const mapExtent = map.extent;
settings
Returns the map settings. These settings include editable layers, layer color settings, etc.
Returns:
Object: Returns settings object.
Example:
const mapSettings = map.settings;
Methods:
getStyle()
Returns the map style. This function is an asynchronous function.
Returns:
Style: Returns style object.
Example:
const mapStyle = await map.getStyle();
getThumbnailURL()
Returns the URL of the map thumbnail.
Returns:
String: Returns thumbnail PNG URL.
Example:
const mapThumbnailUrl = map.getThumbnailURL();
updateSettings(options)
Updates the map settings.
Parameters:
options (Object)
| Name | Description |
|---|---|
|
options.general_settings
Object?
|
An object that includes general settings. Keys and values are:
‘map_unit’: ‘latlng’ | ‘utm’ ‘base_map’: ‘OSM’ | ‘google’ | ‘blank’; ‘flash_color’: ‘rgb(255,0,0)’ (rgb color or rgba color or hex color ) ‘highlight_color’: ‘rgb(255,0,0)’ (rgb color or rgba color or hex color ) ‘selection_color’: ‘rgb(255,0,0)’ (rgb color or rgba color or hex color ) ‘selectable_layers’: ‘ALL’ | null | Comma separated list of layers ‘show_maptip_on’: ‘ALL’ | null | Comma separated list of layers |
|
options.edit_settings
Object?
|
An object that includes edit settings. Keys and values are:
‘target_layer’: name of a vector layer or vector layer view. ‘editable_layers’: ‘ALL’ | null | Comma separated list of layers |
|
options.snap_settings
Object?
|
An object that includes snap settings. Keys and values are:
snap_tolerance’: number of pixels for snap tolerance ‘snap_unit’: ‘pixels’ ‘snap_mode’: ‘both’ | ‘edge’ | ‘vertex’ ‘snap_cache’: number of total features for snap cache ‘snappable_layers’: ‘ALL’ | null | Comma separated list of layers |
|
options.search_settings
Object?
|
An object that includes snap settings. Keys and values are:
‘search_mode’: ‘both’ | ‘markers’ | ‘layers’ ‘search_layers’: ‘ALL’ | null | Comma separated list of layers |
|
options.marker_settings
Object?
|
An object that includes marker settings. Keys and values are:
‘remvoe_unused_tags’: true | false |
|
options.controls
Array?
|
Comma separated list of controls that should be enabled in map. |
Returns:
Object: Returns settings object.
Example:
const mapSettings = await map.updateSettings({
'general_settings': {
'map_unit': 'latlng',
'base_map': 'OSM',
'flash_color': 'rgb(255,0,0)',
'highlight_color': '#fbb440',
'selection_color': '#004cff',
'selectable_layers': 'ALL',
'show_maptip_on': null
},
'edit_settings': {
'target_layer': 'vector/selected-roads',
'editable_layers': 'ALL'
},
'snap_settings': {
'snap_tolerance': 5,
'snap_unit': 'pixels',
'snap_mode': 'both',
'snap_cache': 500,
'snappable_layers': 'ALL'
},
'search_settings': {
'search_mode': 'both',
'search_layers': 'ALL'
},
'marker_settings': {
'remvoe_unused_tags': true
},
'controls': [
'overview',
'scalebar',
'searchbar',
'legend',
'basemaps',
'coordinates',
'measurement',
'print',
'gotoxy',
'location',
'edit'
]
});
getMarkers()
Returns the markers and tags that is stored in the map. This function is an asynchronous function.
Returns:
Object: Returns Markers object. This object contains a list of markers location and tags object.
Example:
const mapMarkers = await map.getMarkers();
setMarkers(options)
Saves the map markers and tags.
Parameters:
options (Object)
| Name | Description |
|---|---|
|
options.tags
Object?
|
An object that includes tags and colors. |
|
options.locations
Array?
|
An array that includes markers objects |
Returns:
Object: Returns Markers object. This object contains a list of markers location and tags object.
Example:
const mapMarkers = await map.setMarkers({
'tags': {
'#general': {
'color': '#ff0000',
}
},
'locations': [
{
'tag': '#general',
'name': 'test',
'geometry': [
51.13162784422988,
35.766603814763045
],
'description': 'string'
}
]
});