[mapserver-users] How to Turn off a Layer when other specific Layer is ON in a map file ?

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Thu Nov 25 04:09:00 PST 2021


Hi Jeff,

I wonder how REQUIRES works/should work with other services. I think that with WCS it cannot work and makes no sense either, with WFS it could work (same effect than modifying the &typenames= ) but maybe does not make sense, but how about vector tiles?

-Jukka Rahkonen-

-----Alkuperäinen viesti-----
Lähettäjä: MapServer-users <mapserver-users-bounces at lists.osgeo.org> Puolesta Jeff McKenna
Lähetetty: keskiviikko 24. marraskuuta 2021 21.18
Vastaanottaja: mapserver-users at lists.osgeo.org
Aihe: Re: [mapserver-users] How to Turn off a Layer when other specific Layer is ON in a map file ?

Ah!  Boy this was tricky to get working.  In my tests, it is the logical operators AND and OR that are not working, with MapServer 8.0-dev (I tested mode=map, map2img/shp2img, WMS GetMap, and PHP MapScript).  But the great news is that something like the following works well, in all modes :

      LAYER
        ..
        REQUIRES "![yourlayername]"
      END


    not working: REQUIRES "![yourlayername] OR ![someotherlayername]"

I'll add these notes to the docs today...   Thanks for the nudge on this 
Carlos!

-jeff




On 2021-11-23 6:07 p.m., Jeff McKenna wrote:
> Indeed I think my testing was wrong, as mode=map and layers= was 
> overriding the REQUIRES parameter, as I see that in msautotest things 
> are working with shp2img.  So, maybe I should not have sent these 
> messages ha.
> 
> -jeff
> 
> 
> 
> On 2021-11-23 5:42 p.m., Rahkonen Jukka (MML) wrote:
>> Hi Jeff,
>>
>> I know REQUIRES has worked in a positive way (show copyright when a 
>> layer is on) because I have used that feature but I do not admin that 
>> service any more and I can't check the details. Probably I used 
>> version 6.x then.
>>
>> -Jukka Rahkonen-
>>
>> -----Alkuperäinen viesti-----
>> Lähettäjä: MapServer-users <mapserver-users-bounces at lists.osgeo.org>
>> Puolesta Jeff McKenna
>> Lähetetty: tiistai 23. marraskuuta 2021 23.35
>> Vastaanottaja: mapserver-users at lists.osgeo.org
>> Aihe: Re: [mapserver-users] How to Turn off a Layer when other 
>> specific Layer is ON in a map file ?
>>
>> To give a more detailed example of what *should* work:
>>
>>     LAYER
>>       ..
>>       REQUIRES "![modis] OR ![someotherlayername]"
>>     END
>>
>> I'll continue my 8.0-dev testing...
>>
>>
>> -jeff
>>
>>
>>
>> --
>> Jeff McKenna
>> GatewayGeo: Developers of MS4W, MapServer Consulting and Training 
>> co-founder of FOSS4G http://gatewaygeo.com/
>>
>>
>> On 2021-11-23 5:29 p.m., Jeff McKenna wrote:
>>> Hi Carlos,
>>>
>>> I had a great answer drafted for you, tooting my own horn on the 
>>> recent MapServer tutorial updates for MapServer 8.x, and the demo 
>>> server updates...as by chance the tutorial mentions that the 
>>> parameter "REQUIRES" at the LAYER level should do exactly what you need, super :
>>> but sadly my tests now fail with MapServer 8.0-dev, I cannot get 
>>> REQUIRES to work, such as:
>>>
>>>     LAYER
>>>      ..
>>>      REQUIRES "![modis]"
>>>     END
>>>
>>>    where modis is another layer name.
>>>
>>> Since I hadn't been testing this feature, and it is only briefly 
>>> mentioned in the tutorial (and not part of the live demo), I have no 
>>> way of saying when this should have worked, for what MapServer 
>>> version.  It is part of the tutorial mapfiles, but the functionality 
>>> is not working, for my local tests.
>>>
>>> But your question has made me see more room for improvement in the 
>>> tutorial, and its mapfiles, so your question has helped.
>>>
>>> Sorry for my non-news, ha.
>>>
>>> I'll do more testing on this feature and report back.
>>>
>>> -jeff
>>>
>>>
>>>
>>
>> _______________________________________________
>> MapServer-users mailing list
>> MapServer-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
> 
> 


--
Jeff McKenna
GatewayGeo: Developers of MS4W, MapServer Consulting and Training co-founder of FOSS4G http://gatewaygeo.com/ _______________________________________________
MapServer-users mailing list
MapServer-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the MapServer-users mailing list