Personal tools
You are here: Home Documentation References

11. OutputFormat

Document Actions
Up one level
This section discusses how output formats are defined and selected.

A map file may have zero, one or more OUTPUTFORMAT object declarations, defining available output formats supported including formats like PNG, GIF, JPEG, GeoTIFF and Flash (SWF).

If OUTPUTFORMAT sections declarations are not found in the map file, the following implicit declarations will be made. Only those for which support is compiled in will actually be available. The GeoTIFF depends on building with GDAL support, and the Flash (SWF) depends on compiling with support for the MING library.

OUTPUTFORMAT
  NAME gif
  DRIVER "GD/GIF"
  MIMETYPE "image/gif"
  IMAGEMODE PC256
  EXTENSION "gif"
END
OUTPUTFORMAT
  NAME png
  DRIVER "GD/PNG"
  MIMETYPE "image/png"
  IMAGEMODE PC256
  EXTENSION "png"
END
OUTPUTFORMAT
  NAME jpeg
  DRIVER "GD/JPEG"
  MIMETYPE "image/jpeg"
  IMAGEMODE RGB
  EXTENSION "jpg"
END
OUTPUTFORMAT
  NAME wbmp
  DRIVER "GD/WBMP"
  MIMETYPE "image/wbmp"
  IMAGEMODE PC256
  EXTENSION "wbmp"
END
OUTPUTFORMAT
  NAME swf
  DRIVER "SWF"
  MIMETYPE "application/x-shockwave-flash"
  EXTENSION "swf"
  IMAGEMODE PC256
  FORMATOPTION "OUTPUT_MOVIE=SINGLE"
END
OUTPUTFORMAT
  NAME GTiff
  DRIVER "GDAL/GTiff"
  MIMETYPE "image/tiff"
  IMAGEMODE RGB
  EXTENSION "tif"
END
NAME [name]
The name to use use in the IMAGETYPE keyword of the map file to select this output format.(optional)
DRIVER [name]
The name of the driver to use to generate this output format. Some driver names include the definition of the format if the driver supports multiple formats. For GD the possible driver names are "GD/Gif", "GD/PNG", "GD/WBMP" and "GD/JPEG". For flash the driver is just called "SWF". For output through GDAL the GDAL shortname for the format is appeneded, such as "GDAL/GTiff". Note that PNG, JPEG and GIF output can be generated with either GDAL or GD (GD is generally more efficient).(manditory)
IMAGEMODE [PC256/RGB/RGBA/INT16/FLOAT32]

Selects the imaging mode in which the output is generated. Does matter for non-raster formats like Flash. Not all formats support all combinations. For instance GD/GIF supports only PC256. (optional)

  • PC256: Produced a pseudocolored result with up to 256 colors in the palette (traditional MapServer mode)
  • RGB: Render in 24bit Red/Green/Blue mode. Supports all colors but does not support transparency.
  • RGBA: Render in 32bit Red/Green/Blue/Alpha mode. Supports all colors, and alpha based transparency.
  • BYTE: Render raw 8bit pixel values (no presentation). Only works for RASTER layers (through GDAL) and WMS layers currently.
  • INT16: Render raw 16bit signed pixel values (no presentation). Only works for RASTER layers (through GDAL) and WMS layers currently.
  • FLOAT32: Render raw 32bit floating point pixel values (no presentation). Only works for RASTER layers (through GDAL) and WMS layers currently.
MIMETYPE [type]
Provide the mime type to be used when returning results over the web. (optional)
EXTENSION [type]
Provide the extension to use when creating files of this type. (optional)
TRANSPARENT [ON/OFF]
Indicates whether transparency should be enabled for this format. Note that transparency does not work for IMAGEMODE RGB output. Not all formats support transparency (optional). When transparency is enabled for the typical case of 8-bit pseudocolored map generation, the IMAGECOLOR color will be marked as transparent in the output file palette. Any other map components drawn in this color will also be transparent, so for map generation with transparency it is best to use an otherwise unused color as the background color.
FORMATOPTION [option]

Provides a driver or format specific option. Zero or more FORMATOPTION statement may be present within a OUTPUTFORMAT declaration. (optional)

  • GD/JPEG: The "QUALITY=n" option may be used to set the quality of jpeg produced (value from 0-100).
  • GD/PNG: The "INTERLACE=[ON/OFF]" option may be used to turn interlacing on or off.
  • GD/GIF: The "INTERLACE=[ON/OFF]" option may be used to turn interlacing on or off.
  • GDAL/GTiff: Supports the TILED=YES, BLOCKXSIZE=n, BLOCKYSIZE=n, INTERLEAVE=[PIXEL/BAND] and COMPRESS=[NONE,PACKBITS,JPEG,LZW,DEFLATE] format specific options.
  • GDAL/*: All FORMATOPTIONs are passed onto the GDAL create function. Options supported by GDAL are described in the detailed documentation for each GDAL format
by Jeff McKenna last modified 2005-12-15 16:52

INTERLACE also applies to JPEGs

Posted by Jeff Hoffmann at 2006-06-28 08:24

The INTERLACE option can be used with GD/JPEG to toggle creation of progressive JPEGs.


Powered by Plone