How to use the @terrestris/ol-util/dist/MapUtil/MapUtil.getAllLayers 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 / Button / GeoLocationButton / GeoLocationButton.tsx View on Github external
constructor(props: BaseProps) {
    super(props);
    const {
      map,
      showMarker
    } = this.props;
    const allLayers = MapUtil.getAllLayers(map);

    this._positions = new OlGeomLineString([], 'XYZM');
    this._geoLocationLayer.setStyle(this._styleFunction);
    if (!allLayers.includes(this._geoLocationLayer)) {
      map.addLayer(this._geoLocationLayer);
    }
    this.state = {};

    if (showMarker) {
      this._markerFeature = new OlFeature();
      this._geoLocationLayer.getSource().addFeature(this._markerFeature);
    }
  }
github terrestris / react-geo / src / LayerTree / LayerTree.tsx View on Github external
getVisibleOlUids = () => {
    const layers = MapUtil.getAllLayers(this.state.layerGroup, (layer) => {
      return !(layer instanceof OlLayerGroup) && layer.getVisible();
    }).filter(this.props.filterFunction);
    return layers.map(l => l.ol_uid.toString());
  }