[Mapserver-users] Problem with colours when displaying a GEOTiff image along with vector layers

Covariance Covariance at shaw.ca
Wed Oct 15 00:13:04 EDT 2003


Ed:
	thank you very much, it worked like a charm. I wonder why this
problem only started in this latest version of the MapServer? - just
curious.

	Bob Bruce

-----Original Message-----
From: Ed McNierney [mailto:ed at topozone.com]
Sent: Tuesday, October 14, 2003 9:52 PM
To: Covariance at shaw.ca; Mapserver Users Mailing List
Subject: RE: [Mapserver-users] Problem with colours when displaying a
GEOTiff image along with vector layers


Bob -

This normally occurs because the relevant portion of the monochrome TIFF
input uses all available colors in the output image palette.  That is,
since the layers are drawn in order, and colors are allocated in order,
if the monochrome raster image uses 256 distinct shades of gray, then
there will be no colors left (in an 8-bit output image) and the vector
layers will use whatever shade of gray most closely matches the
requested color (which usually isn't very close).

Since you're using GDAL for input, you can add the statement

	PROCESSING "COLOR_MATCH_THRESHOLD=3"

to the raster image layer.  This will tell GDAL that when an input pixel
of a new color is encountered, if the RGB distance between it and an
existing color is 3 or less (that is, delta R + delta G + delta B <= 3)
then consider the existing color to be a match and use it.  This will
reduce the number of shades of gray used by the raster image to somewhat
less than 256, leaving you with enough room to allocate the intended
colors for the vector data.

	- Ed


Ed McNierney
President and Chief Mapmaker
TopoZone.com
ed at topozone.com


-----Original Message-----
From: Covariance [mailto:Covariance at shaw.ca]
Sent: Tuesday, October 14, 2003 10:22 PM
To: 'Mapserver Users Mailing List'
Subject: [Mapserver-users] Problem with colours when displaying a
GEOTiff image along with vector layers

I recently downloaded and installed version 4.0 for WIN32 and started
going
through my example files that I had implemented with version 3.5 on
another
computer. Everything was going fine and I was able to display all of my
examples OK until I hit one that had a GEOTiff file, then the colours on
the
vector layer suddenly became monochrome along with the GEOTiff image. If
I
turn off the raster layer then the colours appear fine.

Help on getting the vector colours back along with displaying the raster
layer would be much appreciated.

thanks,
		Bob Bruce

The listing of the MapServer version is:

C:\Program Files\Apache Group\Apache2\cgi-bin>MAPSERV.EXE -v
MapServer version 4.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
OUTPUT=PDF OUTPUT=SWF SUPPORTS=P
ROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIEN
T INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

and the listing of the mapfile (with the raster layer commented out) is:

NAME T12R02E_s2ex2
EXTENT 620000 5537250 631000 5547350
SIZE 400 400
SHAPEPATH "c:/apache/htdocs/tileswwinnipeg"

# LAYER # Single ortho image display
#   NAME "6205531GeoTIFF"
#   DATA "orthodata/6205531G.tiff"
#   STATUS DEFAULT
#   TYPE RASTER
# # OFFSITE 0
# END

LAYER # DLS Polys
  NAME "DLSPolys"
  DATA "t12r02e/t12r02ev03_DLSPolygons"
  STATUS DEFAULT
  TYPE POLYGON
  CLASSITEM "PART"
  CLASS # Whole DLS Parcel
#   STATUS OFF
    NAME "WHOLE DLSPOLY"
    EXPRESSION ""
    COLOR 255 202 149
    OUTLINECOLOR 0 0 0
  END # end of Whole DLS Parcel class object
  CLASS # Part DLS Parcel
    NAME "PART DLSPOLY"
    EXPRESSION "PT"
    COLOR 255 164 72
    OUTLINECOLOR 0 0 0
  END # end of Part DLS Parcel class object
END # end of layer object

LAYER # Plan Parcel Layer
  NAME "Plan Parcels"
  DATA "t12r02e/t12r02ev03_LotPolygons"
  STATUS DEFAULT
  TYPE POLYGON

  CLASSITEM "PART"
  CLASS # Whole Plan Parcels
    NAME "Whole Plan Parcels"
    EXPRESSION ""
    COLOR 212 178 176
    OUTLINECOLOR 0 0 0
  END # end of Whole Plan Parcels class
  CLASS # Part Plan Parcels
    NAME "Part Plan Parcels"
    EXPRESSION "PT"
    COLOR 170 103 100
    OUTLINECOLOR 0 0 0
  END # end of Whole Plan Parcels class
END  # end of water features layer

END # end of map file

_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list