Skip to content

Layer manager

FilipLeitner edited this page Apr 30, 2024 · 10 revisions

Layer manager (switcher) displays layers added to a map grouped by topics similar to directories (path property of layer definition) and allows user to toggle on/off layers and reorder them. It also displays info for broken or not available layers due to current map scale not being in the range of scales supported by the layer.

Config parameters

List of useful config parameters for the layer manager panel can be found here:

clusteringDistance

reverseLayerList

box_layers

pathExclusivity

timeDisplayFormat

Enable/disable

import {HsConfig} from 'hslayers-ng/config';
@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsConfig: HsConfig) {
    this.HsConfig.update({
      panelsEnabled: {
        layermanager: true //false,
      }
    });
  }
}

If not using HslayersModule containing all components

Add HsLayerManagerModule import:

import {HsLayerManagerModule} from 'hslayers-ng/components/layer-manager';
@NgModule({
  imports: [HsLayerManagerModule],
})
export class YourAppModule {}

Add HsLayerManagerComponent:

import {HsLayoutService} from 'hslayers-ng/core';
import {HsLayerManagerComponent} from 'hslayers-ng/components/layer-manager';

@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsLayoutService: HsLayoutService) {
    hsLayoutService.createPanel(HsLayerManagerComponent, {});
  }
}
Clone this wiki locally