[OSGeo-Discuss] Mapserver GetLegendGraphic Colorrange Keyimage problem

Claudio claudio.floretta at fmach.it
Wed Dec 11 08:53:42 PST 2013


Hi list,
I'm working with Mapserver 6.4.0, I publish a WMS with a Raster (tif)
styled with Colorrange and it works with this code:
 
# Layer start
	LAYER
		NAME "classes"
		TYPE RASTER
		OFFSITE 0 0 0 # Ignore the black backgroud color
		METADATA
		  "wms_title"    "regions"
		  "wms_srs"      "EPSG:32632"
		END
		STATUS ON
		DATA "/full/path/to/file.tif"
		PROCESSING "DITHER=yes"
		DUMP true
		PROJECTION 
			"init=epsg:4326"
		END
		END
		CLASS
			NAME "classe1"
			EXPRESSION ([pixel] >= 0 AND [pixel] < 850)	
			STYLE	
				COLORRANGE 0 0 255 0 0 255
				DATARANGE 0 850
				RANGEITEM "pixel"
			END #STYLE
		END #end class
		...same other classes....
	END
# Layer end

Then I tried to add a legend object (over the layer in the mapfile):
	LEGEND
	  STATUS ON
	  KEYSIZE 100 100
	  TRANSPARENT ON
	  LABEL
	      TYPE TRUETYPE
	      FONT 'arial'
	      SIZE 8
	      COLOR 1 1 1
	  END
	END
And the request
"http://......?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=classes&Format=image/png" showed only a list of classes name without images.
Then I read on various post
(http://osgeo-org.1560.x6.nabble.com/Use-of-a-Colortable-td4237911.html)
that I had to add a KEYIMAGE "class4.gif" between EXPRESSION and STYLE.
I tried this but the server retrieved an error: "Premature end of script
headers". 
I tried to put different paths, different image's types, to change the
position of the KEYIMAGE, but without an improvement.

Finally, what I'm trying to do is possible with mapserver? And if it is,
which could be the problem of my mapfile?
Thanks
Claudio






More information about the Discuss mailing list