[MAPSERVER-USERS] WMS: layer status turned to on

Bistrais, Bob Bob.Bistrais at maine.gov
Thu Dec 11 06:31:04 PST 2008


I am facing a similar problem.  In my case, though, I would like the layers in question to default to Status Off, not for scale reasons, but simply because we don't want the layers displayed by default.  The individual layer files are set to Status Off, but when the WMS service is loaded into, for example, ArcGIS, the layers are on by default.

-----Original Message-----
From: Alexandre Dube [mailto:adube at mapgears.com] 
Sent: Thursday, December 11, 2008 9:12 AM
To: Philippe Kruschitz
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [MAPSERVER-USERS] WMS: layer status turned to on

Philippe Kruschitz wrote:
> Hi list,
>
> I have a question concerning the behaviour of Mapserver when acting as a WMS
> server. We have a web mapping application rendering roads and landcover
> information for all Europe. As the dataset is pretty huge, we have to use
> multiple, scale-dependant mapfiles. This was necessary because most of the
> data had to be generalized to improve performance at small scales. The
> layers with the same name in different mapfiles therefore use different
> geometries and some of the layers aren't used in all mapfiles. For example,
> the biggest layer, containing the local roads, is only used in the two last
> mapfiles, at a very large scale.
>
> I was asked to make the data available as a (demo) web mapping service. To
> do this, I added, in our application, a servlet that would pass the request
> to MS, calling different mapfiles while the scale changes. In order to be
> able to answer the GetCapabilities request, a dummy mapfile had to be
> written, containing all the layers that were used across the other mapfiles.
> This forced me to also add the 'missing' layers in each mapfile.
>
> For example, the local roads layer had to be added to the smaller scale
> mapfiles. The status of those additional layers was put to OFF, but the MS
> apparently turns the status to ON when the whole mapfile is requested (WMS
> request --> LAYERS=mapobject_name). As a workaround, to not have the other
> layers displayed, I deleted the class objects in the additional layers, but
> MS logically has to prepare the whole layer for display anyway, resulting in
> horrendous drawing times at small scales. When the single layers are
> selected in the request (LAYERS=country,highways,...), the map will draw
> very fast.
>
> So my question is, is there a way not having the layer status turned to ON
> when the 'root' WMS layer is selected? Or maybe there is another way to tell
> MS to not prepare those layers? As the mapfiles and data structure are very
> complex, setting up dummy (empty) data for each layer would take quite a
> long time.
>
>   

Using MINSCALEDENOM and MAXSCALEDENOM could resolve your problem. Set 
MINSCALEDENOM to 1 to the layers you don't want to show in the dummy 
layer. I'm not sure if that's what you want though, maybe you could 
share a small portion of your mapfile.

An other long solution you could do is to merge all your mapfiles in one 
big mapfile and using MINSCALEDENOM and MAXSCALEDENOM, determine which 
layer is displayed. Layers from the same data source that has been 
generalized would then have a unique name, but you could use GROUP and 
use the group name to call your layers in your requests.

What do you think ?

Alexandre

> I know the whole thing isn't very clean and thoroughly thought through, but
> it had to be completed very fast and that was the best solution I came up
> with. If some of you have ideas on how to improve it, I would be very glad
> to listen to your suggestions.
>
> Best regards,
>
> Philippe Kruschitz
>
> PS: We're using Mapserver 5.0.0
>
>
>
>
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com





More information about the MapServer-users mailing list