working with filters and expressions

James Anderson james at DANISAT.NET
Wed May 4 02:54:03 EDT 2005


Hi all,

I have a great problem.  
I have a shape file layer of some roads.  All the different road types are in the same shape file, and Attibute data is used to specify the road type.  I have a attribute/column named TYPE.  The data here ... eg road types are Paved,Unpaved, Dirt Road, etc

Now what I want is to filter out the road types I dont want.  For this I was assuming the FILTER paramenter under the layer could work.
I have now tried numerous things but nothing much works.  I see lots of others having problems with this.  Reading posts here I see lots of conflicting info.  Some also say you can do the same with the EXPRESSION parameter under your class.
Now I am totally confused.  I have tired things like

FILTER "([TYPE]='Paved' or [TYPE]='Unpaved')"
FILTER "([TYPE] eq 'Paved' or [TYPE] eq 'Unpaved')"

To try and show only paved and unpaved roads.
I get nothing .. not a single thing shows up.  Yet if I remove the filter parameter, all the roads types show.
So I also tried

FILTER "([TYPE]='Paved')" 
FILTER "([TYPE] eq 'Paved')"
FILTER ([TYPE]='Paved') 
FILTER ([TYPE] eq 'Paved')

I get same result .. nothing shows when the filter is present.
However, I have managed to get one thing working:

FILTERITEM "TYPE"
FILTER "Paved"

This works in that it shows only paved roads.  Yet the moment I try and get it to work on more than one roadtype, it freaks out and shows nothing.  I tried doing similar things with the Expression parameter but also with no results.

My Layer looks like this:


LAYER
        NAME "tr_ro_final"
        TYPE line
        CONNECTIONTYPE OGR
        CONNECTION "/maps/tr_ro_final.shp"
        STATUS DEFAULT
        #FILTER "[TYPE] eq 'Unpaved'"
        #FILTERITEM "TYPE"

        #FILTER '!"Dirt Road"'
        #MINSCALE  3.01
        #MAXSCALE 99.01
        CLASS
                #Expression ([TYPE] eq "Unpaved")
                #COLOR 151 75 0
                COLOR 255 0 0
                SYMBOL "circle"
                SIZE 3
        END
END

As you can see I have still left in some of the things I was playing with.  Still .. I have not got far.  I have not been able to find any proper documentation of using mapserver regex or using the filter parameter properly. 

My mapserver version:

MapServer version 4.4.0 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER INPUT=EPPL7 INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

Can anyone help me ?  I am desperate to finally figure this out once and for all.

Thanks,

James Anderson.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050504/dcaeb21b/attachment.html


More information about the mapserver-users mailing list