Skip to content

Legend panel

Raitis Berzins edited this page Oct 6, 2021 · 6 revisions

Legend panel gathers legends from all layers added to map and displays them in a list. They can be ImageWms, TileWms services for which legend is served by the WMS provider (geoserver, mapserver etc.) or Vector layers for which legend is derived from Openlayers style or SLD string. For that geostyler-legend library is used under the hood.

Add HsLegendModule module import:

import {HsLegendModule} from 'hslayers-ng';
@NgModule({
  imports: [HsLegendModule],
})
export class YourAppModule {}

Add HsLegendPanel component:

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