Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
interactions: defaultInteractions(),
layers: [
googleLayer,
osmLayer
],
target: 'map',
view: new View({
center: center,
zoom: 12
})
});
const olGM = new OLGoogleMaps({map: map}); // map is the Map instance
olGM.activate();
const layerSwitcher = new LayerSwitcher();
map.addControl(layerSwitcher);
this.map_.addControl(new MousePosition({
coordinateFormat: createStringXY(0)
}));
}
if (options.addMiniMap) {
this.map_.addControl(new OverviewMap({
collapsed: !options.miniMapExpanded,
view: new View({
projection: this.view_.getProjection(),
resolutions: this.view_.getResolutions()
})
}));
}
if (options.addLayerSwitcher) {
this.map_.addControl(new LayerSwitcher());
}
// Get background layer first...
themes.getBackgroundLayers().then((layers) => {
// The options is an array for backward compatibility reason.
const backgroundLayer = options.backgroundLayers || [constants.backgroundLayer];
for (const layer of layers) {
if (backgroundLayer.includes(layer.get('config.name'))) {
// we don't want the background layer in the layerswitch so we remove the title.
layer.set('title', undefined);
this.map_.addLayer(layer);
}
}
// ... then get overlay layers (if defined)
const overlayLayerNames = options.layers;