Hi,

Couldn't you just add a new field to the DATA clause and use that?

`DATA "geom from (select pk, geom, size, (size * 2) as mycolor from 
sizes_of_thing) USING srid 3788 version 11g" `
`CLASS `
`MAXSCALEDENOM 5001 `
`STYLE `
`    COLOR [`mycolor`]`

Or maybe this is a cut-down example.

`Seth`
``
--
web:https://geographika.net
twitter: @geographika


On Thu, Jun 16, 2022, at 11:04 AM, Andi p3 Domi wrote:
> I am trying to port my code from MapServer 5 (Oracle) to MapServer 7 
> (PostgreSQL), but I am encountering an issue when trying to apply arithmetic 
> expressions in the style class. So previously in MapServer 5 I would have 
> something like:
> 
> `DATA "geom from (select pk, geom, size from sizes_of_thing) USING srid 3788 
> version 11g"
> CLASS
>     MAXSCALEDENOM 5001
>     STYLE
>         COLOR [size*2]
`
> Which worked perfectly fine: But if I convert it to MapServer 7 and 
> PostgreSQL like:
> 
> `DATA "geom from (select pk, geom, size from sizes_of_thing sot) USING unique 
> pk USING srid=3788"
> CLASS
>     STYLE
>         COLOR [size*2]
`
> Throws an error such as:
> 
> `msPostGISLayerWhichShapes(): Error (ERROR:  column "size*2" does not exist
`
> By any chance are these expressions not supported anymore in MapServer 
> 7/PostGIS or am I doing something wrong?
> 
> What I have tried so far is to write something like
> 
> `SIZE [size]*2
> SIZE ([size]*2)
`
> create an expression like:
> 
> `EXPRESSION ("size2" "[size]*2")
`
> And use it in something like:
> 
> `SIZE [size2]
`
> create a validation variable such as:
> 
> `VALIDATION
> "size2" '[size]*2'
`
> and then
> 
> `SIZE [size2]
`
> But it seems like none of them work.
> 
> _______________________________________________
> MapServer-users mailing list
> MapServer-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to