[mapserver-users] opacity and outputformat

Marc-André Trottier trottier.marcandre at gmail.com
Thu May 19 12:15:19 PDT 2011


i'm using MapScript to create un mapObj.
finally a draw the image with Map->draw();

but the OPACITY is not good. Just one OPACITY, of my two layers, is set to
all image

i got this for my Outputformat :

  OUTPUTFORMAT
    NAME "aggpng24"
    MIMETYPE "image/png; mode=24bit"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE "RGBA"
    TRANSPARENT TRUE
  END

i think it's good.

if the address is not the same in the parameter CONNECTION
it's all good.

can i add a random number in my CONNECTION ?
with the mapscript

Marc-André Trottier



2011/5/12 thomas bonfort <thomas.bonfort at gmail.com>
Opacity is set as a single integer between 0 and 100 on the layer level.
There are no limitations on setting it on multiple layers, but in that
case the opacity adds up, so if you have two layers with opacity 50,
the final opacity of the image ends up being 75.

If your final images end up with no opacity, this could be because
your are also including a layer with full opacity, or because you are
using a format which does not support an alpha channel (i.e. jpeg)

regards,
thomas

On Mon, May 9, 2011 at 19:18, Marc-André Trottier
<trottier.marcandre at gmail.com> wrote:
> hi!
> how can i get a output with opacity on 2 or more layers.
> with only 1 layer it's working fine but not with 2 or more.
>
> How should be written OPACITY when using IMAGEMODE RGBA ? (ALPHA)
> i tried something like OPACITY 22,22,22,22 but looks bad
>
> in all my tests, all i got was my 2 layers with full opacity (100) ...
>
> here is my mapfile :
>
>  MAP
>   EXTENT -8146324.306063 5632144.09953312 -8137075.425642 5638229.88815488
>   FONTSET "fonts"
>   IMAGECOLOR 255 255 255
>   IMAGETYPE AGGA
>   SIZE 732 482
>   STATUS ON
>   UNITS METERS
>   NAME "MS"
>
>  OUTPUTFORMAT
>      NAME 'AGGA'
>      DRIVER AGG/PNG
>      IMAGEMODE RGBA
>      TRANSPARENT TRUE
> END
>
>   PROJECTION
>     "init=epsg:900913"
>   END
>   LEGEND
>     IMAGECOLOR 255 255 255
>     KEYSIZE 20 10
>     KEYSPACING 5 5
>     LABEL
>       ANGLE 0.000000
>       ANTIALIAS TRUE
>       FONT "arial"
>       MAXSIZE 256
>       MINSIZE 4
>       SIZE 10
>       TYPE TRUETYPE
>       BUFFER 0
>       COLOR 255 255 255
>       FORCE FALSE
>       MINDISTANCE -1
>       MINFEATURESIZE -1
>       OFFSET 0 0
>       PARTIALS TRUE
>     END
>     OUTLINECOLOR 0 0 0
>     POSITION LR
>     POSTLABELCACHE TRUE
>     STATUS EMBED
>     TRANSPARENT FALSE
>   END
>
>   QUERYMAP
>     COLOR 255 255 0
>     SIZE -1 -1
>     STATUS OFF
>     STYLE HILITE
>   END
>
>   SCALEBAR
>     ALIGN CENTER
>     COLOR 0 0 0
>     IMAGECOLOR 255 255 255
>     INTERVALS 4
>     LABEL
>       SIZE MEDIUM
>       TYPE BITMAP
>       BUFFER 0
>       COLOR 0 0 0
>       FORCE FALSE
>       MINDISTANCE -1
>       MINFEATURESIZE -1
>       OFFSET 0 0
>       PARTIALS TRUE
>       POSITION CR
>     END
>     OUTLINECOLOR 0 0 0
>     POSITION LL
>     SIZE 200 3
>     STATUS EMBED
>     STYLE 0
>     UNITS METERS
>   END
>
>   WEB
>     IMAGEPATH "path"
>     IMAGEURL ""
>     QUERYFORMAT text/html
>     LEGENDFORMAT text/html
>     BROWSEFORMAT text/html
>   END
>
>   LAYER
>     CONNECTION "PATATE3"
>     CONNECTIONTYPE WMS
>     DEBUG 5
>     METADATA
>       "wms_srs"    "EPSG:900913"
>       "wms_name"    "PATATE3"
>       "wms_format"    "image/png"
>       "wms_server_version"    "1.1.1"
>     END
>     NAME "Carte"
>     PROCESSING "CLOSE_CONNECTION=NORMAL"
>     PROJECTION
>       "init=epsg:900913"
>     END
>     STATUS ON
>     TRANSFORM FALSE
>     TYPE RASTER
>     UNITS METERS
>   END
>
>   LAYER
>     CONNECTION "PATATE2"
>     CONNECTIONTYPE WMS
>     DEBUG 5
>     METADATA
>       "wms_srs"    "EPSG:900913"
>       "opacity"    "100"
>       "wms_name"    "PATATE2"
>       "wms_format"    "image/png"
>       "wms_server_version"    "1.1.1"
>     END
>     NAME "PATATE2"
>     PROCESSING "CLOSE_CONNECTION=NORMAL"
>     PROJECTION
>       "init=epsg:900913"
>     END
>     STATUS ON
>     TRANSFORM FALSE
>     TYPE RASTER
>     UNITS METERS
>   END
>
>   LAYER
>     CONNECTION "PATATE"
>     CONNECTIONTYPE WMS
>     DEBUG 5
>     METADATA
>       "wms_srs"    "EPSG:900913"
>       "opacity"    "40"
>       "wms_name"    "PATATE"
>       "wms_format"    "image/png"
>       "wms_server_version"    "1.1.1"
>     END
>     NAME "PATATE"
>     PROJECTION
>       "init=epsg:900913"
>     END
>     STATUS ON
>     OPACITY 40
>     TYPE RASTER
>     UNITS METERS
>   END
>
> END
>
>
> ______________________________
>
> _________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110519/9fc97de6/attachment.htm>


More information about the MapServer-users mailing list