Spectrum Spatial (SSA/LIM)

Expand all | Collapse all

Get all layers of the map

  • 1.  Get all layers of the map

    Posted 04-05-2019 03:32
    Hello,

    For an extension of SSA, I would like to get all layers of the map. I tried "ol.Map.Layers" where ol is the OpenLayer object but Layers is null. Do you have any idea how to do that.

    Thanks you very much,

    Augustin Boyer

    ------------------------------
    Augustin Boyer
    GEO RM
    Jaunay-Marigny
    ------------------------------


  • 2.  RE: Get all layers of the map

    Moderator
    Posted 05-24-2019 06:15
    Hi Augustin,

    Thank you for seeking out suggestions on your query through the Pitney Bowes knowledge community. I have brought this discussion here from the Spectrum Technology Platform community to get you a bigger audience who will be keen to discuss this.

    ------------------------------
    Nalin Mathur
    Pitney Bowes Software India PVT. Ltd
    Noida
    ------------------------------



  • 3.  RE: Get all layers of the map

    Posted 05-24-2019 08:39
    Hi Augustin,

    hoping this can help you - send me a message if you need more support on this - here a sample of searching a layer using his friendlyname into the list of layers. You might work on this code inside your component .ts file.


    import { AddVectorLayerAction } from "src/app/common/store/actions/ol-map-actions";

    AddVectorLayerCustomers() {

          let mapLayerAlreadyVisible: boolean = false;
            let sFriendlyName: string = this.userName + this.typeword + " IN";
            
            this.mapService.getMap().getLayers().forEach((mapLayer: ol.layer.Layer) => {
            if (mapLayer.get('name') === sFriendlyName) {
                mapLayerAlreadyVisible = true;
                //          visible true
                    }
                    
                });
    ...
    }

    ------------------------------
    Monica Di Martino
    EMEA LI/GIS Presales Engineer
    Pitney Bowes
    ------------------------------



  • 4.  RE: Get all layers of the map

    Posted 05-27-2019 07:52
    Hello,

    Finally I found it with the aid of Rachit Jain :
            this.spectrumLayers = this.mapService.getLayersByType(SERVICETYPE.PBMAPPING);
            for ( let idx in this.spectrumLayers ) {
                let mapPath = this.spectrumLayers[idx].getProperties().repositoryPath;
                if ( mapPath ) {
            let layers = this.spectrumLayers[idx].get('namedLayerList');
    ...

    Thanks you for your answer.

    Augustin

    ------------------------------
    Augustin Boyer
    GEO RM
    Jaunay-Marigny
    ------------------------------