<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=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.std
{mso-style-name:std;}
.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 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:419062035;
mso-list-template-ids:-1188126756;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></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="FR" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Dear all,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I am trying to classify a PNG (could be a tiff) which has the 3 bands (red, green, blue), each from 0..255.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I need to classify (not just display it as it is), because I have used those 3 bands to “code” elevation values (it’s a hightmap).
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I am using a PNG to encode the elevation value on those r,g,b bands, rather than one tiff containing directly the elevation on the pixel, because the size of the PNG is smaller than tiff (and I need to store a big amount
of images…).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The formula to “encode” the elevation is<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><i>#min=-50, max=1000 ((r * 256 + g + b / 256) * (Zmax-Zmin)/(65536)) + Zmin*
<o:p></o:p></i></p>
<p class="MsoNormal" style="text-indent:35.4pt"><i><span lang="EN-US">Which I translated as<o:p></o:p></span></i></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt"><i><span lang="EN-US">CLASS #min=-50, max=1000 ((r * 256 + g + b / 256) * (Zmax-Zmin)/(65536)) + Zmin*<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US"> EXPRESSION ( ((( (red]*256) +[green] +([blue]/256)) * (1050/65536)) - 50) <= 0)
<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US"> STYLE<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US"> COLOR 100 195 215<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US"> OPACITY 35<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US"> END<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="EN-US"> END
<o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="EN-US">But, [red]=[green]=[blue]= the value of the first band (red). Always.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">In documentation I can see (http://mapserver.org/mapfile/expressions.html)<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><i><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:FR">For
</span></i><i><span style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:FR"><a href="http://mapserver.org/input/raster.html#raster"><span lang="EN-US" style="color:blue">Raster Data</span></a></span></i><i><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:FR">
layers special attributes have been defined that can be used for classification, for example:<o:p></o:p></span></i></p>
<ul type="disc">
<li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo1">
<i><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:FR">[PIXEL] ... will become the pixel value as number<o:p></o:p></span></i></li><li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo1">
<i><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:FR">[RED], [GREEN], [BLUE] ... will become the color value for the red, green and blue component in the pixel value, respectively.<o:p></o:p></span></i></li></ul>
<p class="MsoNormal"><span lang="EN-US">And (<a href="http://mapserver.org/el/input/raster.html">http://mapserver.org/el/input/raster.html</a>)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><i><span lang="EN-US">There is no need to specify a
</span></i><cite><span lang="EN-US" style="font-family:"Calibri",sans-serif;font-style:normal">CLASSITEM</span></cite><i><span lang="EN-US">. The raw pixel value itself (“[pixel]”) and, for paletted images, the red, green and blue color associated with that
pixel value (“[red]”, “[green]” and “[blue]”) are available for use in classifications.<o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Hope someone can help me on that!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Here is my MapFile.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">MAP<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NAME "test"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> STATUS OFF<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> SIZE 256 256<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> MAXSIZE 4096<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> RESOLUTION 96
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> EXTENT 253999.500 6884000.500 254999.500 6885000.500<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> UNITS DD <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> IMAGETYPE png<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> IMAGECOLOR 255 255 255<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">PROJECTION<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US"> "init=epsg:2154"
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> WEB<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> TEMPLATE "../etc/html_template/getcapabilities_wms_130.html"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> METADATA<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> (…)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> LAYER<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NAME "test"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> TYPE RASTER <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> DATA "/mnt/nemesis_resultats/flood/v3/v4_1m/RGEALTI_FXX_0224_6753_MNT_LAMB93_IGN69_png.png"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> #PROCESSING "BANDS=1,2,3" #this line crashes with a “drawGDAL(): Unable to access file. Attempt to classify 24bit image, this is unsupported.”<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> STATUS ON<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> PROJECTION<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> "init=epsg:2154"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> METADATA<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> (…)
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> CLASS #min=-50, max=1000 ((r * 256 + g + b / 256) * (Zmax-Zmin)/(65536)) + Zmin*<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> EXPRESSION ( ((( (red]*256) +[green] +([blue]/256)) * (1050/65536)) - 50) <= 0)
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> STYLE<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> COLOR 100 195 215<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> OPACITY 35<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> END <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> END #LAYER<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">END <o:p></o:p></span></p>
<p class="MsoNormal"># End of MapFile<o:p></o:p></p>
</div>
</body>
</html>