Layers Control

PreviousNext

Controls the visibility of different map layers.

Controlling Tile Layers

To allow switching between multiple tile layers, wrap several MapTileLayer components inside a MapLayers container and include the MapLayersControl component to provide the UI for switching between them.

If you want to keep the default tile, you can simply include a <MapTileLayer /> without any props.

Controlling Layer Groups

To easily show or hide related markers or features on your map, wrap them in MapLayerGroup components inside a MapLayers container and include the MapLayersControl component to provide users with a UI for toggling the visibility of each group.

Use the defaultLayerGroups prop to specify which layer groups should be visible by default.

Controlling Feature Groups

MapFeatureGroup works similarly to MapLayerGroup.