[mapserver-users] default values if not provided in the URL

Fawcett, David (MPCA) David.Fawcett at state.mn.us
Thu Oct 27 12:19:57 EDT 2011


Two hackish thoughts:

1.  Utilize a pair of mapfiles.  The first one has all of the classes on by default.  The second one has all of the class with STATUS OFF.  

On the client side, you determine if you have any class args and route the request to the appropriate mapfile. If the client has a request with class args, you append one of these for each class  '&map.layer[0].class[3]=status on' (specifying the correct layer and class index values)

If you only had a few classes, you could easily manage this with one mapfile (without running up against the character limits on GET requests)

2.  What are you really trying to do?  It seem like classes are for selecting and symbolizing/formatting data for output.  Do you really want to filter out the data using a filter at the layer level.  If you can avoid running all of your data through the expressions for each class, it should perform better too.

David.

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Puneet Kishor
Sent: Thursday, October 27, 2011 10:50 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] default values if not provided in the URL

the fine manual says http://mapserver.org/cgi/runsub.html

> Since version 5.6, you can provide a default value for any substitution 
> parameter, that will be applied if the parameter was not found in the url. 
> You do this by providing special entries inside the layer metadata :
>
>	METADATA
>  		'default_sound' 'yes'
>		'default_nseats' '5'
>		'default_multimedia' 'yes'
>	END
>
> In this example, the mapfile will be created as if the url contained 
> "&sound=yes&nseats=5&multimedia=yes"


Right then. Except, I want *all* my classes to be drawn if no class has been provided. And, if one or more classes have been provided, then I want only those to be drawn. So, 

	http://server/mapfile?mode=map

should return a map with all the 100+ classes in a layer. And 

	http://server/mapfile?mode=map&classes=Foo,Bar

(or some other variation of the above) should return a map with only the requested classes in the layer. I can't think of anyway of doing the above without resorting to scripting, and I still have had no luck with WMS returned from Perl MapScripting.

Suggestions.

--
Puneet Kishor_______________________________________________
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