[Mapserver-users] Can't view the legend of a raster file

Sonia Rosas sonia.rosas at madrid.sema.slb.com
Wed Feb 5 09:21:28 PST 2003


--Boundary_(ID_vvXXgFot+nX5nXVjSPQYBQ)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT

Hello,
I  would like to view the legend of a raster map built with
MapServer3.6.3 and PHP/MapScript. For shapefiles, I can get the legend,
but with rasters no. I can see the raster map. Part of my mapfile is:

LEGEND
  IMAGECOLOR 255 255 255
  LABEL
    TYPE BITMAP
    SIZE MEDIUM
    COLOR 0 0 89
  END
  STATUS ON
END

LAYER

  NAME Slope
  TYPE RASTER
  DATA slope/hdr.adf
  STATUS ON
  OFFSITE 0

  METADATA
    "DESCRIPTION" "Slope"
    "RESULT_FIELDS" "pixel"
  END

  CLASSITEM "[pixel]"

  CLASS
     EXPRESSION ([pixel] <10 )
     NAME ' 0-9'
     COLOR 254 225 225
  END
 CLASS
...


In the .php3 file, I have used this commands to show the legend:
    $img = $gpoMap->drawLegend();
    $url = $img->saveWebImage($gImagesFmt, 0, 0, -1);
    printf("<b> %s </b><br>", $poLayer->getMetaData("DESCRIPTION"));
    echo"<IMG  SRC=$url  BORDER=0 >\n";

Thanks in advance,
S. Rosas


--Boundary_(ID_vvXXgFot+nX5nXVjSPQYBQ)
Content-type: text/html; charset=us-ascii
Content-transfer-encoding: 7BIT

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hello,
<br>I  would like to view the legend of a raster map built with MapServer3.6.3
and PHP/MapScript. For shapefiles, I can get the legend, but with rasters
no. I can see the raster map. Part of my mapfile is:
<p><i><font size=-1>LEGEND</font></i>
<br><i><font size=-1>  IMAGECOLOR 255 255 255</font></i>
<br><i><font size=-1>  LABEL</font></i>
<br><i><font size=-1>    TYPE BITMAP</font></i>
<br><i><font size=-1>    SIZE MEDIUM</font></i>
<br><i><font size=-1>    COLOR 0 0 89</font></i>
<br><i><font size=-1>  END</font></i>
<br><i><font size=-1>  STATUS ON</font></i>
<br><i><font size=-1>END</font></i>
<p><i><font size=-1>LAYER</font></i>
<p><i><font size=-1>  NAME Slope</font></i>
<br><i><font size=-1>  TYPE RASTER</font></i>
<br><i><font size=-1>  DATA slope/hdr.adf</font></i>
<br><i><font size=-1>  STATUS ON</font></i>
<br><i><font size=-1>  OFFSITE 0</font></i>
<p><i><font size=-1>  METADATA</font></i>
<br><i><font size=-1>    "DESCRIPTION" "Slope"</font></i>
<br><i><font size=-1>    "RESULT_FIELDS" "pixel"</font></i>
<br><i><font size=-1>  END</font></i>
<p><i><font size=-1>  CLASSITEM "[pixel]"</font></i>
<p><i><font size=-1>  CLASS</font></i>
<br><i><font size=-1>     EXPRESSION ([pixel] <10
)</font></i>
<br><i><font size=-1>     NAME ' 0-9'</font></i>
<br><i><font size=-1>     COLOR 254 225 225</font></i>
<br><i><font size=-1>  END</font></i>
<br> <i><font size=-1>CLASS</font></i>
<br>...
<br> 
<p>In the .php3 file, I have used this commands to show the legend:
<br>   <i> $img = $gpoMap->drawLegend();</i>
<br><i>    $url = $img->saveWebImage($gImagesFmt, 0, 0,
-1);</i>
<br><i>    printf("<b> %s </b><br>", $poLayer->getMetaData("DESCRIPTION"));</i>
<br><i>    echo"<IMG  SRC=$url  BORDER=0 >\n";</i><i></i>
<p>Thanks in advance,
<br>S. Rosas
<br> </html>

--Boundary_(ID_vvXXgFot+nX5nXVjSPQYBQ)--



More information about the MapServer-users mailing list