3.4. Layers. Baselayer
December 9, 2021 ยท View on GitHub
Theory
Basemap layers are an integral part of the map. We make working with them easier.
To control the behavior of the basemap layers, we have added several rules:
- the basemap layer is at the very bottom;
- there can only be one basemap layer at a time;
The following methods help to keep track of these rules:
- addBaseLayer
- getActiveBaseLayer
- getBaseLayers
- getBaseLayersIds
- isBaseLayer
In NgwMap, any layer adapter can create a basemap layer. Even GeoJSON. But we've never done that:
ngwMap.addBaseLayer("OSM"),
ngwMap.addBaseLayer("QMS", { qmsId: 529 }),
More examples
Practice
To run this example, you need to execute these commands in the terminal:
npm i
npm start
Open http://localhost:8080.
LAUNCH in the codesandbox.io.