Example 1.8

Changing the Map's Output Format

https://demo.mapserver.org/cgi-bin/mapserv?map=/mapserver/apps/tutorial/htdocs/example1-8.map&layers=states+modis&map.imagetype=AGG&mode=map

Depending on the format you choose, the image may not display on your browser. If the link fails to display on your browser, right click on the graphic above and save the link as whatever format you specified on your mapfile.

The MapFile

Here's the mapfile: Example1-8.map

OUTPUTFORMAT Object

Our mapfile now contains a new object, OUTPUTFORMAT. This object is defined within the MAP object and is used in conjunction with the IMAGETYPE keyword. Depending on the libraries you compiled with MapServer, you can have several output format choices. The AGG library provides PNG, PNG8 and JPEG; The GDAL library, a source for many of MapServer's input formats, can also provide output to PNG, JPEG, TIFF/GeoTIFF, and other raster formats; the Cairo library provides PDF, PNG and SVG output. Have a look at the OUTPUTFORMAT object and experiment by changing the IMAGETYPE keyword on you mapfile. The NAME of your OUTPUT format should be used as your IMAGETYPE value ex: IMAGETYPE png or IMAGETYPE png24).

Please consult the OUTPUTFORMAT object reference.


Back to Example 1.7 | Proceed to Example 1.9