On Oct 27, 2011, at 11:22 AM, Smith, Michael ERDC-CRREL-NH wrote:

> Punnet,
> 
> What I do in the situations where I want to default to all or allow some
> filtered access is
> 
> METADATA
>   "default_classes" "1=1"
> END
> 
> So the dummy condition is passed when no filter is specified.
> 
> 
> 


Believe it or not, I thought up of the above solution myself but discarded it 
because I understood the text in the documents to mean the following --

        FILTER "class = '%class%'"

will be applied if a class is provided. However, if no class is provided, and 
if the following is provided

        METADATA
                "default_class" "1=1"
        END

Then the filter will become "class = '1=1'", which is, of course not correct. 
And, I just checked the logs with the above mods, and my suspicion was proven 
correct. My log file shows ms croaking with the following

select "class",encode(ST_AsBinary(ST_Force_2D("the_geoms"),'NDR'),'hex') as 
geom,"gid" from table where the_geoms && 
GeomFromText('POLYGON((-180.150250417362 -90,-180.150250417362 
90,180.150250417362 90,180.150250417362 -90,-180.150250417362 -90))',4326) and 
(class = '1=1')

Obviously, I do not want "class = '1=1'"


>       
> 
> 
> On 10/27/11 8:49 AM, "Puneet Kishor" <[email protected]> wrote:
> 
>> 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
>> [email protected]
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 

_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to