Hiding and showing
The Felt SDK provides methods to control the visibility of various entities like layers, layer groups, element groups, and legend items. These methods are designed to efficiently handle bulk operations.
Understanding visibility requests
All visibility methods use a consistent structure that allows both showing and hiding entities in a single call:
Layers
Control visibility of layer groups using setLayerVisibility
:
Layer groups
Control visibility of layer groups using setLayerGroupVisibility
:
Element groups
Similarly, control element group visibility with setElementGroupVisibility
:
Legend items
Legend items require both a layer ID and an item ID to identify them. Use setLegendItemVisibility
:
Common use cases
Focusing on a single layer
To focus on a single layer by hiding all others, first get all layers and then use their IDs:
Toggling visibility
When implementing a toggle, you can use empty arrays for the operation you don't need:
Best practices
Batch operations: Use a single call with multiple IDs rather than making multiple calls:
Omit unused properties: When you only need to show or hide, omit the unused property rather than including it with an empty array:
Last updated