options to configure the TileLayer
ReadonlyidThe identifier of the Layer.
Protectedmargindefault tile margin in pixel
maximum zoom level at which data from the Layer will be displayed.
Maximum zoom level at which actual tile data is available from the data source. When the map is zoomed beyond this level, the display loads tiles at maxDataZoom and scales them up.
Same as max
minimum zoom level at which data from the Layer is displayed.
The name of the Layer
Add an EventListener to the layer. Valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear", "styleGroupChange", "styleChange", and "viewportReady"
The detail property of the Event gives additional information about the event. detail.layer is a reference to the layer onto which the event was dispatched and is set for all events.
A string representing the event type to listen for
the listener function that will be called when an event of the specific type occurs
Add a feature to the layer.
the feature to be added to the layer
Optionalstyle: Style[]
optional style the feature should be displayed with.
Add features to the layer.
the features to be added to the layer
Optionalstyle: Style[]
optional style the features should be displayed with.
Get a locally cached tile by quadkey.
the quadkey of the tile
Get provider(s) of this layer.
Get the declarative style definition of this layer.
Get styleGroup for the feature.
This method retrieves a StyleGroup for a given feature, optionally based on the specified zoom level and whether to use the layer default styles.
The feature for which to get the styles.
Optionalzoomlevel: number
The zoom level to use for determining the styles. This parameter should be set as it determines how styles are applied based on zoom. It is only optional if the style definition supports being applied without a specific zoom level.
OptionallayerDefault: boolean
(Optional) A boolean indicating whether to use the layer's default styles. If true, any custom styles set via TileLayer.setStyleGroup are ignored and the default layer styles are returned. If false, the method will return the custom styles set for the feature if available; otherwise, it returns the default layer styles. Default is false.
A readonly StyleGroup representing the styles for the given feature at the specified zoom level. If no styles are found, a falsy value is returned, indicating that the feature is not displayed/visible.
Enable or disable pointer-event triggering for all features of the layer.
Optionalactive: boolean
boolean to enable or disable posinter-events.
boolean indicating if pointer-event triggering is active or disabled.
Remove an EventListener from the layer. Valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear", "styleGroupChange", "styleChange", and "viewportReady"
A string which specifies the type of event for which to remove an event listener.
The listener function of the event handler to remove from the TileLayer.
Remove feature(s) from the layer.
features that should be removed from the layer
Search for feature(s) in the layer.
configure the search
search a feature by id.
Optionalonerror?: (Function to be called when a request of a "remote search" fails.
Optionalonload?: (result: Feature<string>) => voidCallback function for "remote" search.
Optionalremote?: booleanForce the data provider(s) to do remote search if no result is found in local cache.
array of features
Search for feature(s) in the layer.
configure the search
Optionalids?: number[] | string[]Array of feature ids to search.
Optionalonerror?: (Function to be called when a request of a "remote search" fails.
Optionalonload?: (result: Feature<string>[]) => voidCallback function for "remote" search.
Optionalpoint?: GeoPointGeographical center point of the circle to search in. options.radius must be defined.
Optionalradius?: numberRadius of the circle in meters, it is used in "point" search.
Optionalrect?: GeoRect | GeoJSONBBoxGeographical Rectangle to search in. [minLon, minLat, maxLon, maxLat] | GeoRect.
Optionalremote?: booleanForce the data provider(s) to do remote search if no result is found in local cache.
array of features
// searching features by id:
layer.search({ids: [1058507462, 1058507464]})
// searching by point and radius:
layer.search({
point: {longitude: 72.84205, latitude: 18.97172},
radius: 100
})
// searching by Rect:
layer.search({
rect: {minLon: 72.83584, maxLat: 18.97299, maxLon: 72.84443, minLat: 18.96876}
})
// remote search:
layer.search({
rect: {minLon: 72.83584, maxLat: 18.97299, maxLon: 72.84443, minLat: 18.96876},
remote: true, // force layer to do remote search if feature/search area is not cached locally
onload: (result) => {...}
})
Rectangle Search for feature(s) in the layer.
Geographical Rectangle to search in. [minLon, minLat, maxLon, maxLat] | GeoRect.
Optionaloptions: {configure the search
Optionalonerror?: (Function to be called when a request of a "remote search" fails.
Optionalonload?: (result: Feature<string>[]) => voidCallback function for "remote" search.
Optionalremote?: booleanForce the data provider(s) to do remote search if no result is found in local cache.
layer.search({minLon: 72.83584, maxLat: 18.97299, maxLon: 72.84443, minLat: 18.96876})
// or:
layer.search([72.83584, 18.96876, 72.84443,18.97299])
// remote search:
layer.search({ minLon: 72.83584, maxLat: 18.97299, maxLon: 72.84443, minLat: 18.96876 }, {
remote: true, // force layer to do remote search if search area is not cached locally
onload: (result) => {...}
})
Circle Search for feature(s) in the layer.
Geographical center point of the circle to search in. options.radius must be defined.
configure the search
Optionalonerror?: (Function to be called when a request of a "remote search" fails.
Optionalonload?: (result: Feature) => voidCallback function for "remote" search.
Optionalradius?: numberthe radius is mandatory for circle search.
Optionalremote?: booleanForce the data provider(s) to do remote search if no result is found in local cache.
layer.search({longitude: 72.84205, latitude: 18.97172},{
radius: 100
})
// or:
layer.search([72.84205, 18.97172], {
radius: 100
})
// remote search:
layer.search([72.84205, 18.97172], {
radius: 100,
remote: true, // force layer to do remote search if search area is not cached locally
onload: function(result){
// search result is only return in this callback function if features are not found in cache.
}
})
Search for feature by id in the layer.
id of the feature to search for
Optionaloptions: { onload?: (result: Feature) => void; remote?: boolean }
configure the search
Optionalonload?: (result: Feature) => voidCallback function for "remote" search.
Optionalremote?: booleanForce the data provider(s) to do remote search if no result is found in local cache.
Modify coordinates of a feature in the layer.
the Feature whose coordinates should be modified
the modified coordinates to set. The coordinates must match features geometry type.
Set the tile margin in pixel.
the tileMargin
Set layer with given style.
the layerStyle
keep and reuse custom set feature styles that have been set via TileLayer.setStyleGroup
Set StyleGroup the feature should be rendered with. Pass styleGroup = false|null to hide the feature. If no styleGroup is passed, custom feature style will be cleared and layer default style will be set.
Sets the visibility of the Layer.
This function controls whether the tile layer is currently displayed or hidden.
OptionalisVisible: boolean
A boolean value indicating whether the tile layer should be visible (true) or hidden (false).
The MVTLayer is a TileLayer designed to work with remote datasources that are delivering MVT encoded vector tiles.
Example