How to use the @terrestris/ol-util/dist/MapUtil/MapUtil.getLegendGraphicUrl function in @terrestris/ol-util

To help you get started, we’ve selected a few @terrestris/ol-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github terrestris / react-geo / src / Legend / Legend.spec.tsx View on Github external
it('generates getLegendGraphicUrl if no "legendUrl" configured (extraParams)', () => {
      const extraParams = {
        HEIGHT: 400,
        WIDTH: 400,
        LANGUAGE: 'de'
      };
      const wrapper = TestUtil.mountComponent(Legend, {
        layer: layer1,
        extraParams: extraParams
      });
      const img = wrapper.find('img').getElement();
      const legendUrl = MapUtil.getLegendGraphicUrl(layer1, extraParams);
      expect(img.props.src).toBe(legendUrl);
    });
github terrestris / react-geo / src / Legend / Legend.spec.tsx View on Github external
it('generates getLegendGraphicUrl if no "legendUrl" configured', () => {
      const wrapper = TestUtil.mountComponent(Legend, {layer: layer1});
      const img = wrapper.find('img').getElement();
      const legendUrl = MapUtil.getLegendGraphicUrl(layer1);
      expect(img.props.src).toBe(legendUrl);
    });
github terrestris / react-geo / src / Legend / Legend.tsx View on Github external
getLegendUrl(layer: OlLayer, extraParams: any) {
    let legendUrl;

    if (layer.get('legendUrl')) {
      legendUrl = layer.get('legendUrl');
    } else {
      legendUrl = MapUtil.getLegendGraphicUrl(layer, extraParams);
    }

    return legendUrl;
  }