File

libs/open-layers/src/lib/controls/legend/ol-layer-abstract/ol-layer-abstract.component.ts

Description

Legend component to display the abstract, gathered by the WMS capabilities

Implements

OnInit

Metadata

selector n52-ol-layer-abstract
templateUrl ./ol-layer-abstract.component.html

Index

Properties
Methods
Inputs

Constructor

constructor(wmsCaps: WmsCapabilitiesService)
Parameters :
Name Type Optional
wmsCaps WmsCapabilitiesService No

Inputs

layer
Type : Layer

Methods

ngOnInit
ngOnInit()
Returns : void

Properties

Public abstract
Type : string
import { Component, Input, OnInit } from '@angular/core';
import { Required } from '@helgoland/core';
import { Layer } from 'ol/layer';
import { TileWMS } from 'ol/source';

import { WmsCapabilitiesService } from '../../../services/wms-capabilities.service';

/**
 * Legend component to display the abstract, gathered by the WMS capabilities
 */
@Component({
  selector: 'n52-ol-layer-abstract',
  templateUrl: './ol-layer-abstract.component.html'
})
export class OlLayerAbstractComponent implements OnInit {

  @Required @Input() layer: Layer;

  public abstract: string;

  constructor(
    private wmsCaps: WmsCapabilitiesService,
  ) { }

  ngOnInit() {
    const source = this.layer.getSource();
    this.layer.getExtent();
    if (source instanceof TileWMS) {
      const url = source.getUrls()[0];
      const layerid = source.getParams()['layers'] || source.getParams()['LAYERS'];
      this.wmsCaps.getAbstract(layerid, url).subscribe(res => this.abstract = res);
    }
  }

}
<span>{{abstract}}</span>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""