Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How can I tell mapserver to ignore a filter that is set in a mapfile?

I am displaying a wms layer with point features using mapserver. In one of the layers in my mapfile I have defined a filter similar to this:

FILTER          "mycolumn='%myvalue%'"

such that I can use runtime substitution in a mapserver request similar to this one:

http://someurl.com/mapserv?map=mymap.map&layer=mylayer&mode=map&myvalue=thisvalue

This works just fine.

However, sometimes I would like to display the entire dataset and thus forcing mapserver to ignore the filter.

Is it possible to deactivate the filter in a request?

share|improve this question
add comment

2 Answers

A working solution is similar to what @seruva19 suggested. The trick is to add a boolean value to the filter as an alternative to the previous filter:

FILTER    "(mycolumn='%myvalue%') or %allvars%"

where the validation forces the value to be TRUE

VALIDATION
  ...
  "allvals"    "^TRUE$"
END

and the default of allvals is set to FALSE

METADATA
    ...
    'default_allvals'   'FALSE'
END
share|improve this answer
add comment

I'm not sure, but this trick may work:

  1. Add FILTER to validation block of the layer's description, like this:

    LAYER
    ...
        VALIDATION
          'FILTER' '.'
        END
    ...
    
  2. When you want to show all of the data in your layer, add the following string to your URL request :

    &map.layer[mylayer]=FILTER+("[mycolumn]"+~*+".")
    

I hope this will help.

share|improve this answer
    
thanks a lot seruva19, your answer hinted in the right direction, helping me to get to the solution. I did not understand how yours works exactly... –  yellowcap Oct 9 '12 at 19:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.