Managing feature visibility for Mapbox
Overview
Methods
hideFeatures(features: string[]): void
hideFeatures(features: string[]): void// Creating two arrays: one which hides 3D features,
// and the other one that hides 2D features.
const features3DToHide = [
FeatureType.WALLS3D,
FeatureType.MODEL3D,
FeatureType.EXTRUSION3D,
FeatureType.EXTRUDEDBUILDINGS
];
const features2DToHide = [
FeatureType.MODEL2D,
FeatureType.WALLS2D
];
// Then calling each function either on button click or toggle.
function hide3DFeatures() {
mapView.hideFeatures(features3DToHide);
}
function hide2DFeatures() {
mapView.hideFeatures(features2DToHide);
}
// Calling hideFeatures with an empty array as a parameter will result in
// showing all the features.
function showFeatures() {
mapView.hideFeatures([])
}

getHiddenFeatures(): string[]
getHiddenFeatures(): string[]FeatureType(): string[]
FeatureType(): string[]Conclusion
Last updated
Was this helpful?