Skip to main content
Version: General Availability - 1.0.6.X

User Highlights

Highlight temporary GeoJSON features (e.g. search results outline or analytics region) without altering layer data.

addUserHighlight

Add or replace the current user highlight overlay.

Parameters:

FieldTypeRequiredDescription
geoJsonObjectFeatureCollectionYesGeoJSON FeatureCollection to render as highlight.

const geojson = [
{
"type": "Feature",
"properties": {
"stroke": "#00a803",
"stroke-width": 2,
"stroke-opacity": 1,
"fill": "#a80000",
"fill-opacity": 0.4
},
"geometry": {
"coordinates": [
[
[
115.7720489423204,
-31.872207865620858
],
[
115.7720489423204,
-32.191197409197464
],
[
116.08269304511589,
-32.191197409197464
],
[
116.08269304511589,
-31.872207865620858
],
[
115.7720489423204,
-31.872207865620858
]
]
],
"type": "Polygon"
},
"id": 0
}
]

control.addUserHighlight({
type: 'FeatureCollection',
features: geojson
});

clearUserHighlight

Remove the current highlight overlay.

Parameters: None

control.clearUserHighlight();