Layers
getGalleryLayers
List available gallery layers.
Parameters: None
Usage:
const gallery = await control.getGalleryLayers();
Response
[
{
"layerId": "d9ba522d-f7ef-4147-9a85-0d14b15f38ca",
"layerName": "Contact",
"layerType": "DataverseLayer",
"layerDescription": "Person with whom a business unit has a relationship, such as customer, supplier, and colleague.",
"subLayers": [
{
"sublayerId": "7b406359-6d7f-4109-8179-37d62a89638d",
"sublayerName": "My Active Contacts",
"sublayerDescription": null
},
{
"sublayerId": "a5e611d9-b6b4-431a-816b-cc6eca6d52b8",
"sublayerName": "All Contacts",
"sublayerDescription": null
}
]
}
]
getSublayerAttributes
Gets all sublayers details
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| layerId | string | Yes | Id of a parent returned by getGalleryLayers(). |
| sublayerId | string | Yes | Id of a sublayer returned by getGalleryLayers(). |
Usage:
const attributes = await control.getSublayerAttributes(layerId, sublayerId);
Response
{
"sublayerId": "7b406359-6d7f-4109-8179-37d62a89638d",
"sublayerName": "My Active Contacts",
"sublayerDescription": null,
"subLayerAttributes": [
{
"fieldName": "contactid",
"displayName": "Contact",
"displayType": "String",
"isFilterable": true,
"orderNumber": 1,
"type": "guid",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "emailaddress1",
"displayName": "Email",
"displayType": "String",
"isFilterable": true,
"orderNumber": 2,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "fullname",
"displayName": "Full Name",
"displayType": "String",
"isFilterable": true,
"orderNumber": 3,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "parentcustomerid",
"displayName": "Company Name",
"displayType": "Object",
"isFilterable": true,
"orderNumber": 4,
"type": "object",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "telephone1",
"displayName": "Business Phone",
"displayType": "String",
"isFilterable": true,
"orderNumber": 5,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "mtrcore_latitude",
"displayName": "Latitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 262,
"type": "number",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "mtrcore_longitude",
"displayName": "Longitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 263,
"type": "number",
"value": "",
"visibility": true,
"enabled": true
}
]
}
createSublayerInstance
Enable a sublayer based on enabled layers
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| layerId | string | Yes | Id of a parent returned by getGalleryLayers(). |
| sublayerId | string | Yes | Id of a sublayer returned by getGalleryLayers(). |
| overrides | MaptaskrSublayerOverrides | No | Optional sublayer override settings for the new instance. |
MaptaskrSublayerOverrides Interface
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | No | Unique identifier for the preconfigured layer object. |
| layerId | string | No | Parent layer id returned by getGalleryLayers(). |
| subLayerId | string | No | Sublayer id returned by getGalleryLayers(). |
| visibleByDefault | boolean | No | Whether the layer is visible when the map first loads. |
| defaultOpacity | number | No | Default layer opacity (typically 0 to 1). |
| instanceName | string | No | Display name for the created layer instance. |
| additionalDefaultClickAction | string | undefined | No | Optional default click action key for feature interaction. |
| additionalSingleRecordActions | IAction[] | No | Additional actions available for single selected records. |
| additionalMultiRecordActions | IAction[] | No | Additional actions available for multi-selected records. |
| additionalFilter | Filter | No | Optional default filter applied when the sublayer instance is created. |
| showDataTabByDefault | boolean | No | Whether the data tab opens by default for the layer instance. |
| enableClickableFeatures | boolean | No | Whether map features are clickable. |
| preventClosingDataTab | boolean | No | Whether users can close the data tab for this layer instance. |
| filterToView | boolean | No | Whether results are constrained to the current map view extent. |
| autoRefresh | boolean | No | Whether the layer instance refreshes automatically. |
| defaultClickOverride | boolean | No | Whether custom click behavior overrides default click behavior. |
| layerStyleData | string | No | Serialized MapLibre style JSON document (for example top-level version, sources, layers). |
| enableDataTab | boolean | No | Optional override to enable or disable the data tab for this layer instance. |
layerStyleData is a JSON string representing a full MapLibre style document.
Maptaskr uses MapLibre style spec concepts under the hood, so this payload is where you can override how the enabled sublayer is rendered (for example line width, fill color, circle radius, labels, and visibility rules).
Use the MapLibre style document model when building this payload:
- Required top-level fields are
version,sources, andlayers. - Each layer in
layersshould includeid,type, andsource. - Common optional layer fields are
filter,layout,paint, andmetadata.
Reference: MapLibre Layer Spec
Example style payload (line layer):
const lineStyleData = JSON.stringify({
"version": 8,
"sources": {
"arcgis-feature-source": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": []
}
}
},
"layers": [
{
"type": "fill",
"source": "arcgis-feature-source",
"metadata": {
"legendname": "N"
},
"layout": {
"visibility": "visible"
},
"paint": {
"fill-color": "#1D4ED8",
"fill-opacity": 1
},
"minzoom": 0
}
]
});
Usage:
await control.createSublayerInstance(layerId, sublayerId, {
instanceName: 'All records (styled)',
visibleByDefault: true,
layerStyleData: JSON.stringify({
"version": 8,
"sources": {
"arcgis-feature-source": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": []
}
}
},
"layers": [
{
"type": "fill",
"source": "arcgis-feature-source",
"metadata": {
"legendname": "New Fill"
},
"layout": {
"visibility": "visible"
},
"paint": {
"fill-color": "#1D4ED8",
"fill-opacity": 1
},
"minzoom": 0
}
]
}),
});
If your sublayer contains multiple geometry renderers (for example fill + circle), include each renderer as a separate item in
layers.
createSublayerInstanceWithFilter
Enable a sublayer with an initial filter based on enabled layers
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| layerId | string | Yes | Id of a parent returned by getGalleryLayers(). |
| sublayerId | string | Yes | Id of a sublayer returned by getGalleryLayers(). |
| filter | Filter | Yes | Filter object applied immediately after the instance is added. |
| overrides | MaptaskrSublayerOverrides | No | Optional sublayer override settings for the new instance. |
MaptaskrSublayerOverrides Interface
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | No | Unique identifier for the preconfigured layer object. |
| layerId | string | No | Parent layer id returned by getGalleryLayers(). |
| subLayerId | string | No | Sublayer id returned by getGalleryLayers(). |
| visibleByDefault | boolean | No | Whether the layer is visible when the map first loads. |
| defaultOpacity | number | No | Default layer opacity (typically 0 to 1). |
| instanceName | string | No | Display name for the created layer instance. |
| additionalDefaultClickAction | string \ | undefined | No |
| additionalSingleRecordActions | IAction[] | No | Additional actions available for single selected records. |
| additionalMultiRecordActions | IAction[] | No | Additional actions available for multi-selected records. |
| additionalFilter | Filter | No | Optional default filter applied when the sublayer instance is created. |
| showDataTabByDefault | boolean | No | Whether the data tab opens by default for the layer instance. |
| enableClickableFeatures | boolean | No | Whether map features are clickable. |
| preventClosingDataTab | boolean | No | Whether users can close the data tab for this layer instance. |
| filterToView | boolean | No | Whether results are constrained to the current map view extent. |
| autoRefresh | boolean | No | Whether the layer instance refreshes automatically. |
| defaultClickOverride | boolean | No | Whether custom click behavior overrides default click behavior. |
| layerStyleData | string | No | Serialized MapLibre style JSON document (for example top-level version, sources, layers). |
| enableDataTab | boolean | No | Optional override to enable or disable the data tab for this layer instance. |
Usage:
await control.createSublayerInstanceWithFilter(layerId, sublayerId, {
type: 'ui' // will always be ui,
expressions: [{ field: 'status', operator: 'equals', value: 'Active' }],
matchType: 'all'
}, {
instanceName: 'Active records only',
visibleByDefault: true,
});
getEnabledSublayerInstances
Return an array of currently enabled (instantiated) sublayer instances.
Parameters: None
Usage:
const enabled = await control.getEnabledSublayerInstances();
console.log(enabled);
Response
[
{
"sublayerInstanceId": "15f3289e-96e7-4a92-9906-f0633c5b2991",
"sublayerId": "76eb4e4a-6864-4534-9cd2-6e355eab0061",
"sublayerName": "All Accounts",
"subLayerAttributes": [
{
"fieldName": "name",
"displayName": "Account Name",
"displayType": "String",
"isFilterable": true,
"orderNumber": 5,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "telephone1",
"displayName": "Main Phone",
"displayType": "String",
"isFilterable": true,
"orderNumber": 8,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "address1_city",
"displayName": "Address 1: City",
"displayType": "String",
"isFilterable": true,
"orderNumber": 2,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "_primarycontactid_value",
"displayName": "Primary Contact Id",
"displayType": "String",
"isFilterable": true,
"orderNumber": 6,
"type": "lookup",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "_primarycontactid_value@OData.Community.Display.V1.FormattedValue",
"displayName": "Primary Contact",
"displayType": "String",
"isFilterable": true,
"orderNumber": 6,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "statecode",
"displayName": "Status Value",
"displayType": "String",
"isFilterable": true,
"orderNumber": 7,
"type": "picklist",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "statecode@OData.Community.Display.V1.FormattedValue",
"displayName": "Status",
"displayType": "String",
"isFilterable": true,
"orderNumber": 7,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "accountid",
"displayName": "Account",
"displayType": "String",
"isFilterable": true,
"orderNumber": 1,
"type": "guid",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "cr019_relatedcontacts",
"displayName": "Related Contacts",
"displayType": "String",
"isFilterable": true,
"orderNumber": 4,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "cr019_booleantest",
"displayName": "Boolean Test",
"displayType": "Boolean",
"isFilterable": true,
"orderNumber": 3,
"type": "boolean",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "accountprimarycontactidcontactcontactid.emailaddress1",
"displayName": "Email",
"displayType": "String",
"isFilterable": true,
"orderNumber": 1,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "address1_latitude",
"displayName": "Address 1: Latitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 11,
"type": "number",
"value": "",
"visibility": false,
"enabled": true
},
{
"fieldName": "address1_longitude",
"displayName": "Address 1: Longitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 12,
"type": "number",
"value": "",
"visibility": false,
"enabled": true
}
],
"sublayerOpacity": 100,
"sublayerIsVisible": true,
"subLayerLegendHtml": "<table><tr>\n\t\t\t\t<td><div style=\"display: flex; align-items: center; gap: 8px;\"><div><svg width=\"32px\" height=\"32px\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-hidden=\"true\" role=\"img\" class=\"iconify iconify--gis\">\n\t\t<circle cx=\"50%\" cy=\"50%\" r=\"10\" fill=\"rgb(230, 154, 0)\" fill-opacity=\"1\" stroke=\"#0033E6\" stroke-width=\"1\" stroke-opacity=\"1\"></circle>\n\t</svg></div><span></span></div></td>\n\t\t\t</tr><tr>\n\t\t\t\t<td><div style=\"display: flex; align-items: center; gap: 8px;\"><div><svg width=\"32px\" height=\"32px\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<path d=\"m33.162,19.463a3.5,3.5 0 0 0 -3.111,1.974l-20.711,42.802a3.5,3.5 0 0 0 2.632,4.985l75.015,11.275a3.5,3.5 0 0 0 3.846,-4.55l-14.267,-43.493a3.5,3.5 0 0 0 -2.431,-2.293l-40.04,-10.586a3.5,3.5 0 0 0 -0.933,-0.115l0,0.001z\" fill=\"#0033E6\" fill-opacity=\"0.5\"/>\n\t\t<path d=\"m33.162,19.463a3.5,3.5 0 0 0 -3.111,1.974l-20.711,42.802a3.5,3.5 0 0 0 2.632,4.985l75.015,11.275a3.5,3.5 0 0 0 3.846,-4.55l-14.267,-43.493a3.5,3.5 0 0 0 -2.431,-2.293l-40.04,-10.586a3.5,3.5 0 0 0 -0.933,-0.115l0,0.001z\" fill=\"#00000000\" stroke=\"#0033E6\" stroke-width=\"2\" stroke-opacity=\"1\"/>\n\t/>\n\t</svg></div><span>Account Boundaries</span></div></td>\n\t\t\t</tr></table>",
"subLayerFilterJSON": "{\"type\":\"ui\",\"matchType\":\"all\",\"expressions\":[]}"
}
]
getEnabledSublayerInstances() returns both layer details and the layer legend markup (subLayerLegendHtml).
This was added so you can build a reusable HTML legend segment outside of the map control (for example, in side panels, print layouts, export previews, or custom reporting pages).
const sublayers = window.MaptaskrControlManager.getControl(controlId).getEnabledSublayerInstances();
const escapeHtml = (value: unknown) =>
String(value ?? '')
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
const rows = sublayers
.map(
(layer) => `
<tr>
<td>${escapeHtml(layer.sublayerName)}</td>
<td>${layer.subLayerLegendHtml || '<em>No legend</em>'}</td>
</tr>
`
)
.join('');
const html = `
<table>
<thead>
<tr>
<th>Layer Name</th>
<th>Legend</th>
</tr>
</thead>
<tbody>
${rows}
</tbody>
</table>
`.trim();
console.log(html);
// document.getElementById('legend-container')!.innerHTML = html;
What this form is useful for:
- Passing the legend HTML to print/export pipelines that accept HTML input.
- Reusing the same legend output in emails, reports, or embedded dashboards.
Important:
- The output is HTML markup, not an image.
- If you need an image or PDF, render the HTML first, then use a separate conversion step (for example, browser print-to-PDF or HTML-to-image tooling).
Implementation notes:
- Escape plain text fields such as
sublayerNamebefore inserting into HTML. subLayerLegendHtmlis already HTML markup, so render it as HTML (do not escape it).- If a sublayer has no legend, show a fallback like
<em>No legend</em>.
showSublayerInstance
Once a sublayer is available in layer panel then you can toggle its visibility
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Id of the enabled sublayer instance to make visible. |
Usage:
await control.showSublayerInstance(sublayerInstanceId);
hideSublayerInstance
Once a sublayer is available in layer panel then you can toggle its visibility
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Id of the enabled sublayer instance to hide. |
Usage:
control.hideSublayerInstance(sublayerInstanceId);
removeSublayerInstance
Removes the layer instance from the layer panel and the map. This action fully disables the layer until it is re-added.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Id of the enabled sublayer instance to remove entirely. |
Usage:
control.removeSublayerInstance(sublayerInstanceId);
navigateToSublayerInstance
Pans and zooms the map to the geographic extent of the specified enabled layer instance.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Id of the enabled sublayer instance whose extent to navigate to. |
Usage:
control.navigateToSublayerInstance(sublayerInstanceId);
filterSublayerInstance
Apply or replace a filter on an existing sublayer instance. Each call overwrites the previous filter of the same filter type.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Target enabled sublayer instance. |
| filter | Filter | Yes | Object with type, expressions[], matchType ('all' or 'any'). Overwrites previous filter of same type. |
Usage:
control.filterSublayerInstance(instanceId, {
type: 'ui',
expressions: [{ field: 'priority', operator: 'greaterThanOrEquals', value: 3 }],
matchType: 'all',
});
Use distinct type values (e.g. ui, search, action) to layer multiple logical filters if supported.
clearFilterFromSublayerInstance
Removes any filter applied to an active sublayer in the panel
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Id of the enabled sublayer instance to clear filters from. |
Usage:
control.clearFilterFromSublayerInstance(sublayerInstanceId);
updateSublayerInstanceOpacity
Change the visual opacity (transparency) of a sublayer instance.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Id of the enabled sublayer instance to modify. |
| opacity | number | Yes | 0 (transparent) to 100 (opaque). Values outside range are clamped. |
Usage:
await control.updateSublayerInstanceOpacity(instanceId, 50);
getVisibleSublayerInstanceData
Retrieve a paged set of features currently within the map view for a given instance.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Instance whose visible features to fetch. |
| pageNumber | number | Yes | 1-based page index. |
| pageToken | string | Optional | Continuation token from prior call if paging further. |
Usage:
const page1 = await control.getVisibleSublayerInstanceData(instanceId, 1);
if (page1?.nextPageToken) {
const page2 = await control.getVisibleSublayerInstanceData(instanceId, 2, page1.nextPageToken);
}
Response
{
"features": [
{
"id": "1757988822653",
"geometry": {
"type": "Point",
"coordinates": [
121.85909,
-27.4556179
]
},
"properties": {},
"centroid": {
"x": 121.85909,
"y": -27.4556179,
"z": 0
},
"extent": {
"xmin": 121.85909,
"ymin": -27.4556179,
"xmax": 121.85909,
"ymax": -27.4556179,
"zmin": 0,
"zmax": 0,
"spatialReference": {
"wkid": 4326,
"latestWkid": 4326
}
},
"totalCoordinateCount": 1,
"levelOfDetail": 0,
"layerInstanceId": "fba870dc-284d-4b7d-a37f-84ed3a9ada8d"
},
{
"id": "1757988822654",
"geometry": {
"type": "Point",
"coordinates": [
122.1263031,
-27.636399
]
},
"properties": {},
"centroid": {
"x": 122.1263031,
"y": -27.636399,
"z": 0
},
"extent": {
"xmin": 122.1263031,
"ymin": -27.636399,
"xmax": 122.1263031,
"ymax": -27.636399,
"zmin": 0,
"zmax": 0,
"spatialReference": {
"wkid": 4326,
"latestWkid": 4326
}
},
"totalCoordinateCount": 1,
"levelOfDetail": 0,
"layerInstanceId": "fba870dc-284d-4b7d-a37f-84ed3a9ada8d"
}
],
"allDataReturned": true
}
getAllSublayerInstanceData
Retrieve paged features ignoring current map extent (full dataset slice for the instance, subject to server limits).
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Instance whose full dataset slice to fetch. |
| pageNumber | number | Yes | 1-based page index. |
| pageToken | string | Optional | Continuation token from prior call if paging further. |
Usage:
control.getAllSublayerInstanceData(sublayerInstanceId, 1);
querySublayerInstanceData
Retrieve paged features with custom filtering by map extent, search text, and filter expressions. Unlike getAllSublayerInstanceData, which returns only features already filtered by the map's default filters and search mechanisms, this function allows direct querying of the layer with your own custom parameters, giving you full control over the results.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| sublayerInstanceId | string | Yes | Instance to query. |
| mapExtent | Extent | Yes | Geographic extent to filter by; pass undefined to ignore extent filtering. |
| pageNumber | number | Yes | 1-based page index. |
| nextPageToken | string | Optional | Continuation token from prior call if paging further. |
| searchText | string | Optional | Free-text search string to match against indexed fields. |
| searchFilter | FilterGroup | Optional | Structured filter expressions to apply in addition to search text. |
| searchWithinFilteredAreas | boolean | Optional | If true, search is constrained to areas already filtered by other mechanisms. |
| abortSignal | AbortSignal | Optional | Signal to cancel the request if still pending. |
Usage:
const control = globalThis.MaptaskrControlManager.getControl(controlId);
const preloadedSublayerID = 'a5e611d9-b6b4-431a-816b-cc6eca6d52b8'; //the sublayer you are looking for
// Wait for sublayerInstanceId to become available
async function waitForSublayerInstanceId(timeoutMs = 10000, intervalMs = 1000) {
const start = Date.now();
while (Date.now() - start < timeoutMs) {
const instances = control.getEnabledSublayerInstances();
const match = instances.find((i) => i?.sublayerId === preloadedSublayerID);
if (match) {
console.log('Sublayer instance found:', match.sublayerInstanceId);
return match.sublayerInstanceId;
}
console.log('Waiting for sublayer instance to be available...');
await new Promise((resolve) => setTimeout(resolve, intervalMs));
}
console.warn('Timed out waiting for sublayer instance.');
return null;
}
const sublayerInstanceId = await waitForSublayerInstanceId();
if (!sublayerInstanceId) {
console.error('Cannot proceed without sublayerInstanceId');
return;
}
const filterField = 'fullname';
const filterOperator = 'contains';
const filterValue = 'steve';
const results = await control.querySublayerInstanceData(
sublayerInstanceId, // this is the SUBLAYERINSTANCEID not SUBLAYERID - you need to find the instances with getEnabledSublayerInstances
undefined, // either an extent (see getMapExtent) or undefined
1, // the page number starting at 1
undefined, // the next page token, if you dont need it, set it to undefined
undefined, // the free text search field, if you dont want to search, set this to undefined
{
filters: [
//filter object must exist.
{
type: 'search', // this MUST be the word 'search'
expressions: [
{
field: filterField, // the field name to filter by
operator: filterOperator, // the operator to use (equals, contains, etc...)
value: filterValue, // the value of the field to filter
},
],
matchType: 'all', // match type can be 'any' or 'all'
},
],
},
false, // set to true if you wish to only return results in filtered areas, false if you wish to search the world
undefined // the abort signal (used to abort the call if required), set to undefined if you dont know what this means
);
showVisibleDataTabForSublayerInstance
Displays the data tab for the specified sublayer instance, automatically filtering the table to show only the features currently visible within the user's map view. Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Instance whose data tab should display filtered to current map view. |
Usage:
control.showVisibleDataTabForSublayerInstance(subLayerInstanceId);
moveLayerZOrder
Changes the Z-order of an enabled sublayer instance so it draws in front of or behind other sublayers in the map and layer panel. Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| sublayerInstanceId | string | Yes | Instance of the sublayer you want to reposition. |
| orderAction | string | Yes | One of sendBackward, sendToBack, bringForward, bringToFront describing whether to move the layer back or front. |
Usage:
control.moveLayerZOrder(subLayerInstanceId, orderAction);
Example
const control = globalThis.MaptaskrControlManager.getControl(controlId);
async function MoveLayerToBack() {
try {
// Get all enabled instances
const enabled = await control.getEnabledSublayerInstances();
// Filter out all bar the one you want to move
const contactSublayer = enabled.findLast((sublayer) => sublayer.sublayerName === 'All Contacts');
if (!contactSublayer) {
console.warn('No enabled "All Contacts" sublayers found.');
return;
}
// Move the selected sublayer to the back of the Z-order
control.moveLayerZOrder(contactSublayer.sublayerInstanceId, 'sendToBack');
} catch (error) {
console.error('Error in MoveLayerToBack:', error);
}
}
showAllDataTabForSublayerInstance
Displays the data tab for the specified sublayer instance, displaying all data for that sublayer.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Instance whose full data tab should display (ignores current view extent). |
Usage:
control.showAllDataTabForSublayerInstance(subLayerInstanceId);
hideDataTabForSublayerInstance
Hides the data tab for the specified sublayer instance.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | Instance whose data tab should be hidden. |
Usage:
control.hideDataTabForSublayerInstance(subLayerInstanceId);
hideAllDataTabs
Hides all data tabs on the map.
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| subLayerInstanceId | string | Yes | (Optional usage) Provided if API supports targeted hide; otherwise hides all tabs regardless. |
Usage:
control.hideAllDataTabs(subLayerInstanceId);