[Mapserver-users] Classes based on Postgis && function
Jan Hartmann
jhart at frw.uva.nl
Tue Feb 18 05:09:15 PST 2003
Benjamin,
You can use named computed variables in PostgreSQL:
select table1.the_geom from
( select table1.the_geom,table2.the_geom, table1.oid
case when table1.fieldX = 'x' then 1
when table1.the_geom && table2.the_geom then 2
end as myclass
from table1,table2
where table1.id = table2.id
) as foo using unique=table1.oid using srid=...
after which you can use the new computed variable "myclass" as a regular
MapServer CLASSITEM. The computed values of this variable go into the
EXPRESSION statement:
CLASSITEM myclass
CLASS
EXPRESSION 1
COLOR ...
...
END
CLASS
EXPRESSION 2
COLOR ...
...
END
Jan
Benjamin Wragg wrote:
> Hi guys,
>
> Does anyone know if its possible to have a layer with two classes, one
> with a simple SQL expression and the other with a SQL statement that
> uses a PostGIS spatial function. Something like the following logic:
>
> class 1 = where table1.fieldX = 'x'
> class 2 = where table1.fieldX = 'x' and table1.the_geom &&
> table2.the_geom and table2.fieldY='Y'
>
> I can do it in two layers, but is it possible in one layer with two classes?
>
> Cheers,
>
> Benjamin
Jan Hartmann
Department of Geography
University of Amsterdam
jhart at frw.uva.nl
More information about the MapServer-users
mailing list