Spectrum Spatial (SSA/LIM)

 View Only

Dynamically displaying raster layers in SSA from infotemplate

  • 1.  Dynamically displaying raster layers in SSA from infotemplate

    Posted 02-22-2022 04:01
    Edited by Peter Møller 02-22-2022 04:37

    Is it possible to add dynamic layer trigger through infotemplate?

    How to use OpenLayers to create a dynamic raster layer? I can do it with vector layers, but what should I use for raster layer?


    For example, my current code for adding vector object through a search:

    onEnter1(event) {

      var see=this;

      let spectrumLayers=see.mapService.getLayersByType(SERVICETYPE.VECTOR_LAYER);


        for(var i=0; i<spectrumLayers.length; i++){

          if(spectrumLayers[i].S.friendlyName == "otsitav massiiv"){

            see.store.dispatch(new DeleteLayerAction({name: spectrumLayers[i].S.name}));

            see.store.dispatch(new RemoveLegendByNameAction(spectrumLayers[i].S.name));




      var vTunnus=document.getElementById("myInput2").value.replace(/\s/g, "");


      const vectorSourceM=new ol.source.Vector({});

      see.featureService.searchBySql({sql:"Select * from \"/yld/NamedTables/pria_massiiv\" where MASSIIVI_NR in (" + vTunnus + ")" }).subscribe((data) => {

        var sisend_cnt=vTunnus.split(',').length;

        var valjund_cnt=data.features.length;



            see.warning("Otsitavast "+String(sisend_cnt)+" massiivist leiti "+String(valjund_cnt)+"!");


          vectorSourceM.addFeatures((new ol.format.GeoJSON()).readFeatures(data));

          var vectorLayerM={

            friendlyName: 'otsitav massiiv',

            source: vectorSourceM,

            style: {

              fillPattern: 20,

              polyFillColor: "#FF1744",

              polyFillPatternImage: 11,

              polyStrokeColor: "#9e5202",

              polyStrokePattern: 2,

              polyStrokeWidth: 3



          see.store.dispatch(new AddVectorLayerAction(vectorLayerM));


          see.danger("Otsitavaid massiive ei leitud!");





    Any advice would be helpful. Thank you!




    -Mati Tee-

    Mati Tee
    Ruumab OU