<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML-esimuotoiltu Char";
        margin:0cm;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTML-esimuotoiltuChar
        {mso-style-name:"HTML-esimuotoiltu Char";
        mso-style-priority:99;
        mso-style-link:HTML-esimuotoiltu;
        font-family:Consolas;
        mso-fareast-language:FI;}
span.Shkpostityyli22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Adding a link to the same question asked earlier in gis.stackexchange:
<a href="https://gis.stackexchange.com/questions/433659/mapserver-7-arithmetic-expressions-do-not-work-on-style-attributes/433664#433664">
https://gis.stackexchange.com/questions/433659/mapserver-7-arithmetic-expressions-do-not-work-on-style-attributes/433664#433664</a>.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> MapServer-users <mapserver-users-bounces@lists.osgeo.org>
<b>Puolesta </b>Andi p3 Domi<br>
<b>Lähetetty:</b> torstai 16. kesäkuuta 2022 12.05<br>
<b>Vastaanottaja:</b> mapserver-users@lists.osgeo.org<br>
<b>Aihe:</b> [mapserver-users] Fwd: MapServer 7 arithmetic expressions do not work on STYLE attributes?<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<p><span style="font-size:12.0pt">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:<o:p></o:p></span></p>
<pre><code>DATA "geom from (select pk, geom, size from sizes_of_thing) USING srid 3788 version 11g"<o:p></o:p></code></pre>
<pre><code>CLASS<o:p></o:p></code></pre>
<pre><code>    MAXSCALEDENOM 5001<o:p></o:p></code></pre>
<pre><code>    STYLE<o:p></o:p></code></pre>
<pre><code>        COLOR [size*2]<o:p></o:p></code></pre>
<p><span style="font-size:12.0pt">Which worked perfectly fine: But if I convert it to MapServer 7 and PostgreSQL like:<o:p></o:p></span></p>
<pre><code>DATA "geom from (select pk, geom, size from sizes_of_thing sot) USING unique pk USING srid=3788"<o:p></o:p></code></pre>
<pre><code>CLASS<o:p></o:p></code></pre>
<pre><code>    STYLE<o:p></o:p></code></pre>
<pre><code>        COLOR [size*2]<o:p></o:p></code></pre>
<p><span style="font-size:12.0pt">Throws an error such as:<o:p></o:p></span></p>
<pre><code>msPostGISLayerWhichShapes(): Error (ERROR:  column "size*2" does not exist<o:p></o:p></code></pre>
<p><span style="font-size:12.0pt">By any chance are these expressions not supported anymore in MapServer 7/PostGIS or am I doing something wrong?<o:p></o:p></span></p>
<p><span style="font-size:12.0pt">What I have tried so far is to write something like<o:p></o:p></span></p>
<pre><code>SIZE [size]*2<o:p></o:p></code></pre>
<pre><code>SIZE ([size]*2)<o:p></o:p></code></pre>
<p><span style="font-size:12.0pt">create an expression like:<o:p></o:p></span></p>
<pre><code>EXPRESSION ("size2" "[size]*2")<o:p></o:p></code></pre>
<p><span style="font-size:12.0pt">And use it in something like:<o:p></o:p></span></p>
<pre><code>SIZE [size2]<o:p></o:p></code></pre>
<p><span style="font-size:12.0pt">create a validation variable such as:<o:p></o:p></span></p>
<pre><code>VALIDATION<o:p></o:p></code></pre>
<pre><code>"size2" '[size]*2'<o:p></o:p></code></pre>
<p><span style="font-size:12.0pt">and then<o:p></o:p></span></p>
<pre><code>SIZE [size2]<o:p></o:p></code></pre>
<p><span style="font-size:12.0pt">But it seems like none of them work.<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>