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

Sonia Rosas sonia.rosas at madrid.sema.slb.com
Wed Feb 5 12:21:28 EST 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&nbsp; 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>&nbsp; IMAGECOLOR 255 255 255</font></i>
<br><i><font size=-1>&nbsp; LABEL</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp; TYPE BITMAP</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp; SIZE MEDIUM</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp; COLOR 0 0 89</font></i>
<br><i><font size=-1>&nbsp; END</font></i>
<br><i><font size=-1>&nbsp; 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>&nbsp; NAME Slope</font></i>
<br><i><font size=-1>&nbsp; TYPE RASTER</font></i>
<br><i><font size=-1>&nbsp; DATA slope/hdr.adf</font></i>
<br><i><font size=-1>&nbsp; STATUS ON</font></i>
<br><i><font size=-1>&nbsp; OFFSITE 0</font></i>
<p><i><font size=-1>&nbsp; METADATA</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp; "DESCRIPTION" "Slope"</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp; "RESULT_FIELDS" "pixel"</font></i>
<br><i><font size=-1>&nbsp; END</font></i>
<p><i><font size=-1>&nbsp; CLASSITEM "[pixel]"</font></i>
<p><i><font size=-1>&nbsp; CLASS</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp; EXPRESSION ([pixel] &lt;10
)</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp; NAME ' 0-9'</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp; COLOR 254 225 225</font></i>
<br><i><font size=-1>&nbsp; END</font></i>
<br>&nbsp;<i><font size=-1>CLASS</font></i>
<br>...
<br>&nbsp;
<p>In the .php3 file, I have used this commands to show the legend:
<br>&nbsp;&nbsp;&nbsp;<i> $img = $gpoMap->drawLegend();</i>
<br><i>&nbsp;&nbsp;&nbsp; $url = $img->saveWebImage($gImagesFmt, 0, 0,
-1);</i>
<br><i>&nbsp;&nbsp;&nbsp; printf("&lt;b> %s &lt;/b>&lt;br>", $poLayer->getMetaData("DESCRIPTION"));</i>
<br><i>&nbsp;&nbsp;&nbsp; echo"&lt;IMG&nbsp; SRC=$url&nbsp; BORDER=0 >\n";</i><i></i>
<p>Thanks in advance,
<br>S. Rosas
<br>&nbsp;</html>

--Boundary_(ID_vvXXgFot+nX5nXVjSPQYBQ)--



More information about the mapserver-users mailing list