working with filters and expressions

Sean Gillies sgillies at FRII.COM
Wed May 4 06:11:12 PDT 2005


On May 4, 2005, at 12:54 AM, James Anderson wrote:

> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_00C0_01C55086.D2691930
> Content-Type: text/plain;
>         charset="Windows-1252"
> Content-Transfer-Encoding: quoted-printable
>
>
> Hi all,
>
> I have a great problem. =20
> 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]=3D'Paved' or [TYPE]=3D'Unpaved')"
> FILTER "([TYPE] eq 'Paved' or [TYPE] eq 'Unpaved')"
>

James,

In MapServer's expression language, all variables on the left hand side
such as [TYPE] are evaluated numerically unless explicitly cast as
strings using quotes.  The following should work

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

You would probably benefit from processing your data so that it has
integer type attributes to do

     FILTER ([FTYPE] = 1)   # Paved

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://zcologia.com



More information about the MapServer-users mailing list