<div dir="ltr">Hi All<div><br></div><div>I'm trying to use mapscript Python bindings to create a gradient on a raster coming from PostGIS.</div><div>My Source looks like the following.</div><div><br></div><div><font face="courier new, monospace" size="1">...</font></div>
<div><p style="margin:0px"><font face="courier new, monospace" size="1">map_class = mapscript.classObj()</font></p>
<p style="margin:0px;min-height:13px"><br></p>
<p style="margin:0px"><font face="courier new, monospace" size="1"><a href="http://map_class.name">map_class.name</a> = <span style="color:rgb(209,47,27)">"test"</span></font></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">map_class.setExpression(<span style="color:rgb(209,47,27)">"([pixel] >= 0 AND [pixel] <= 1000)"</span>)</font></p>
<p style="margin:0px;min-height:13px"><br></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">map_style = mapscript.styleObj()</font></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">map_style.rangeitem = <span style="color:rgb(209,47,27)">"[pixel]"</span></font></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">map_style.maxcolor.setRGB(<span style="color:rgb(39,42,216)">250</span>, <span style="color:rgb(39,42,216)">250</span>, <span style="color:rgb(39,42,216)">210</span>)</font></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">map_style.mincolor.setRGB(<span style="color:rgb(39,42,216)">178</span>, <span style="color:rgb(39,42,216)">34</span>, <span style="color:rgb(39,42,216)">34</span>)</font></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">map_style.minvalue = <span style="color:rgb(39,42,216)">0</span></font></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">map_style.maxvalue = <span style="color:rgb(39,42,216)">1000</span></font></p>
<p style="margin:0px;min-height:13px"><br></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">map_class.insertStyle(map_style)</font></p>
<p style="margin:0px"><font face="courier new, monospace" size="1">layer.insertClass(map_class)</font></p><p style="margin:0px"><font face="courier new, monospace" size="1">...</font></p></div><div><br></div><div><br></div>
<div>and the generated mapfile like this:</div><div><br></div><div><br></div><div><font face="courier new, monospace" size="1">...</font></div><div><div><font face="courier new, monospace" size="1"> STATUS ON</font></div>
<div><font face="courier new, monospace" size="1"> TILEITEM "location"</font></div><div><font face="courier new, monospace" size="1"> TYPE RASTER</font></div><div><font face="courier new, monospace" size="1"> UNITS METERS</font></div>
<div><font face="courier new, monospace" size="1"> CLASS</font></div><div><font face="courier new, monospace" size="1"> NAME "test"</font></div><div><font face="courier new, monospace" size="1"> EXPRESSION ([pixel] >= 0 AND [pixel] <= 1000)</font></div>
<div><font face="courier new, monospace" size="1"> STYLE</font></div><div><font face="courier new, monospace" size="1"> RANGEITEM "[pixel]"</font></div><div><font face="courier new, monospace" size="1"> COLORRANGE 178 34 34 250 250 210</font></div>
<div><font face="courier new, monospace" size="1"> DATARANGE 0 1000</font></div><div><font face="courier new, monospace" size="1"> END # STYLE</font></div><div><font face="courier new, monospace" size="1"> END # CLASS</font></div>
<div><font face="courier new, monospace" size="1"> END # LAYER</font></div></div><div><font face="courier new, monospace" size="1">...</font></div><div><br></div><div><br></div><div>The Problem is, that the gradient is never applied to the raster file. Here (<a href="http://lists.osgeo.org/pipermail/mapserver-users/2011-November/070820.html">http://lists.osgeo.org/pipermail/mapserver-users/2011-November/070820.html</a>) the <b>RANGEITEM</b> is not set, but here (<a href="http://mapserver.org/development/rfc/ms-rfc-6.html">http://mapserver.org/development/rfc/ms-rfc-6.html</a>) they write that the <b>RANGEITEM</b> is mandatory. So</div>
<div><ul><li>when I try to remove that <b>RANGEITEM</b> in the Python source, then the STYLE section would be empty</li><li>when I add it using the value <b>[pixel]</b> or <b>pixel,</b> the gradient is never applied to the raster</li>
</ul><div>Does anyone has an idea what I'm doing wrong?</div></div><div><br></div><div>Thanks a lot for any help</div><div><br></div><div><br></div></div>