Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4260 closed defect (fixed)

OPACITY ignored in mapfile if COLOR read from an feature attribute

Reported by: panzel Owned by: sdlime
Priority: normal Milestone: 6.2 release
Component: MapServer C Library Version: 6.0
Severity: normal Keywords:
Cc:

Description

Within a layer of type polygon, the explicit OPACITY setting is ignored if the COLOR is read from an attribute. I present below a simple mapfile demonstrating the problem. The problem occurs whether output is AGG/PNG or Cairo/SVG. The problem also occurs whether data is read from embedded features (as in this mapfile) or from an external Sql Server 2008 database. I'm using MapServer 6.0.1.

MAP
    # Demonstrate that if COLOR is retrieved from feature data, 
    # then OPACITY must be similarly retrieved to be effective.
    # If OPACITY is explicitly set, its setting is ignored.

    # Layers: 
    #  hatched: a background diagonal hatch
    #  left-overlay:
    #    both opacity (less than 100%) and color explicitly set
    #  middle-overlay:
    #    opacity explicitly set, color taken from feature data
    #  right-overlay:
    #    both opacity and color taken from feature data

    # Result for AGG/PNG output:
    #   Note that the middle-overlay's "OPACITY 25" is ignored 
    #   and the default (100%) opacity is used. If, as in the 
    #   right-overlay, the opacity is also pulled from the 
    #   feature data, then the reduced opacity (25%) is used.

  STATUS ON
  imagetype 'png'

  OUTPUTFORMAT
    NAME 'svg'
    DRIVER CAIRO/SVG
    MIMETYPE 'image/svg+xml'
    IMAGEMODE RGB
    EXTENSION 'svg'
  END
  OUTPUTFORMAT
    NAME 'png'
    DRIVER AGG/PNG
    MIMETYPE 'image/png'
    IMAGEMODE RGB
    EXTENSION 'png'
    FORMATOPTION 'GAMMA=0.75'
  END

  SIZE 400 200
  extent 0 0 399 199

  symbol  name 'hatch'  type hatch  end

  LAYER
    name 'hatched'
    status on
    type polygon
    transform false
    feature points 0 0  0 199  399 199  399 0  0 0 end end    
    class
      STYLE
        SYMBOL 'hatch'
        COLOR 255 0 0
        ANGLE 45
        SIZE 10
        WIDTH 1
      END
    end
  END # end of layer 'hatched'

  LAYER
    name 'left-overlay'
    status on
    type polygon
    transform false
    PROCESSING "ITEMS=rgbColor,opacity"
    feature 
      items '#00ff00;25'
      points 50 50  50 150  150 150  150 50  50 50 end 
    end
    class
      STYLE
        opacity 25
        COLOR '#00ff00'
      END
    end
  END # end of layer 'left-overlay'

  LAYER
    name 'middle-overlay'
    status on
    type polygon
    transform false
    PROCESSING "ITEMS=rgbColor,opacity"
    feature 
      items '#00ff00;25'
      points 150 50  150 150  250 150  250 50  150 50 end 
    end
    class
      STYLE
        opacity 25
        COLOR [rgbColor]
      END
    end
  END # end of layer 'middle-overlay'

  LAYER
    name 'right-overlay'
    status on
    type polygon
    transform false
    PROCESSING "ITEMS=rgbColor,opacity"
    feature 
      items '#00ff00;25'
      points 250 50  250 150  350 150  350 50  250 50 end 
    end
    class
      STYLE
        opacity [opacity]
        COLOR [rgbColor]
      END
    end
  END # end of layer 'right-overlay'
END  # end of MAP

Change History (2)

comment:1 by tbonfort, 12 years ago

Milestone: 6.2 release
Resolution: fixed
Status: newclosed

fixed in r13294 and r13295 . Not tested but pretty confident it will work as advertized, reopen if not.

comment:2 by panzel, 12 years ago

Thanks, Thomas. - Phil

Note: See TracTickets for help on using tickets.