[mapserver-users] WMS GetMap request - incorrect layer ordering
Rahkonen Jukka
Jukka.Rahkonen at mmmtike.fi
Wed Oct 19 10:01:11 PDT 2011
Hi,
Sorry, you are right, having STATUS DEFAULT is placing the mask layer on the bottom. Please consider creating a bug or feature request.
Here is an example.
http://188.64.1.61/cgi-bin/mapserv?map=/usr/map/osm-mapserver_i.map&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=459&HEIGHT=353&LAYERS=borders&TRANSPARENT=TRUE&FORMAT=image%2Fpng&BBOX=2517824.575070821,6461673.824362606,4426029.305949009,7929203.824362606&SRS=EPSG:2393&STYLES=
And this is my the mask layer
LAYER
TYPE POLYGON
STATUS DEFAULT
REQUIRES "[borders]"
#GROUP "default"
NAME "mask"
DUMP TRUE
PROJECTION
"init=epsg:2393"
END
DATA "/usr/data/vektorit/mask.shp"
CLASS
STYLE
COLOR 100 100 190
END
END
END
-Jukka-
________________________________________
Lähettäjä: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] käyttäjän Rahkonen Jukka [Jukka.Rahkonen at mmmtike.fi] puolesta
Lähetetty: 19. lokakuuta 2011 19:29
Vastaanottaja: John Cartwright; mapserver-users at lists.osgeo.org
Aihe: Re: [mapserver-users] WMS GetMap request - incorrect layer ordering
Hi,
Works for me. Do you have raster layer first in the mapfile, mask underneath it?
-Jukka-
________________________________________
Lähettäjä: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] käyttäjän John Cartwright [John.C.Cartwright at noaa.gov] puolesta
Lähetetty: 19. lokakuuta 2011 19:00
Vastaanottaja: mapserver-users at lists.osgeo.org
Aihe: Re: [mapserver-users] WMS GetMap request - incorrect layer ordering
Thanks Jukka. Unfortunately, setting "STATUS DEFAULT" forces the mask
layer to the bottom of the draw order so it can't do it's job.
Approaching the problem from a different perspective - are you aware of
any raster processing directive which would clip a layer on the fly?
Thanks again for all your help on this.
--john
On 10/19/2011 03:37 AM, Rahkonen Jukka wrote:
> Hi,
>
> I spent several hours with blind eyes before having a coffee break and now I really hope that it is this easy: Change the mask layer to STATUS DEFAULT.
>
> Logic is: Draw the mask layer always (STATUS DEFAULT) but because of REQUIRES only if the condition is fulfilled. Mask should not appear with your other layers.
>
> -Jukka Rahkonen-
>
>
> John Cartwright wrote:
>> Lähetetty: 19. lokakuuta 2011 6:12
>> Vastaanottaja: mapserver-users at lists.osgeo.org
>> Aihe: Re: [mapserver-users] WMS GetMap request - incorrect
>> layer ordering
>>
>> Thank you both for your suggestions, but I can't seem to get
>> this to work either w/ shp2img or a WMS request. I've
>> configured the layers as:
>>
>> LAYER
>> NAME countries
>> TYPE POLYGON
>> STATUS on
>> ...
>> END
>>
>> LAYER
>> NAME mask
>> TYPE POLYGON
>> STATUS on
>> REQUIRES "[countries]"
>> ...
>> END
>>
>> Then requesting
>>
>> http://localhost/cgi-bin/basicworld?request=getmap&service=wms
> &width=500&height=250&bbox=-180,-90,180,90&srs=EPSG:4326&version=> 1.1.1&layers=countries&format=png
>> shows the countries layer unmasked. Explicitly adding the
>> mask to the request as below displays the countries layer
>> masked, but is not a solution for me as I have to enforce the mask.
>>
>> http://localhost/cgi-bin/basicworld?request=getmap&service=wms
> &width=500&height=250&bbox=-180,-90,180,90&srs=EPSG:4326&version=> 1.1.1&layers=countries,mask&format=png
>>
>> The debugging log suggests that only the countries layer is
>> being requested:
>>
>> [Tue Oct 18 21:00:20 2011].525713 msDrawMap(): rendering
>> using outputformat named png (AGG/PNG).
>> [Tue Oct 18 21:00:20 2011].525903 msDrawMap(): WMS/WFS set-up
>> and query, 0.000s
>> [Tue Oct 18 21:00:20 2011].537968 msDrawMap(): Layer 1
>> (countries), 0.012s
>> [Tue Oct 18 21:00:20 2011].537982 msDrawMap(): Drawing Label
>> Cache, 0.000s
>> [Tue Oct 18 21:00:20 2011].537989 msDrawMap() total time: 0.013s
>> [Tue Oct 18 21:00:20 2011].555843 msSaveImage(stdout) total
>> time: 0.018s
>> [Tue Oct 18 21:00:20 2011].555881 mapserv request processing
>> time (msLoadMap not incl.): 0.031s
>> [Tue Oct 18 21:00:20 2011].555888 msFreeMap(): freeing map at
>> 0x100832600.
>>
>> Did I misunderstand what you intended?
>>
>> Thanks again!
>>
>> --john
>>
>>
>>
>>
>> On Oct 18, 2011, at 8:06 AM, Daniel Morissette wrote:
>>
>>> On 11-10-18 04:36 AM, Rahkonen Jukka wrote:
>>>> Hi,
>>>> It is also possible to create a mask layer with REQUIRES
>> keywork. The
>>>> snippet below will make the "mask" layer to draw always when the
>>>> "countries" layer is drawn. However, it is not
>> automatically drawn if
>>>> you ask for any other layer. One minory drawback is that
>> the mask layer
>>>> is also listed in the GetCapabilities as a normal WMS layer.
>>>> LAYER
>>>> NAME "mask"
>>>> ....
>>>> REQUIRES "[countries]"
>>>> ...
>>>> END
>>> Great suggestion. And with MapServer 6.x you can hide the
>> mask layer from the GetCapabilities using the
>> "ows_enable_request" metadata:
>>> LAYER
>>> NAME "mask"
>>> ....
>>> REQUIRES "[countries]"
>>> METADATA
>>> "ows_enable_request" "!GetCapabilities"
>>> ...
>>> END
>>> ...
>>> END
>>>
>>> --
>>> Daniel Morissette
>>> http://www.mapgears.com/
>>> Provider of Professional MapServer Support since 2000
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list