Skip to Content
Web Mapping Illustrated
book

Web Mapping Illustrated

by Tyler Mitchell
June 2005
Beginner to intermediate
372 pages
10h 1m
English
O'Reilly Media, Inc.
Content preview from Web Mapping Illustrated

Setting Output Image Formats

MapServer can produce map images, legends, and scale bars in different image formats. Throughout this chapter, the PNG format is shown in the examples because it is the default image format. MapServer packages can have different default image formats. PNG format is commonly supported by many MapServer packages, but in some cases MapServer may not be able to produce PNG files or doesn't produce them by default.

Tip

MapServer can be compiled using many different options. The term "MapServer package" refers to the set of programs, e.g., shp2img, that you are using. The capabilities of these programs depend on how they are compiled. Some packages will have more features enabled than others.

The output image format can be explicitly set in the map file. This requires adding a single line specifying the output format you are requesting. Example 10-11 shows the additional line added to the earlier example map file.

Example 10-11. Specifying the output image format as JPEG

MAP
  SIZE 600 300
  EXTENT -180 -90 180 90
  IMAGECOLOR 180 180 250
  IMAGETYPE JPEG

  UNITS DD
...

This setting can be overridden when using the shp2img command with the -i option. It can't be overridden when using commands such as scalebar or legend, as mentioned earlier in "Creating Your First Map Image."

The IMAGETYPE specified must be one supported by the MapServer package you are running. To check what output formats your installation supports, run the mapserv file (or mapserv.exe on Windows) with ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Flask Web Development, 2nd Edition

Flask Web Development, 2nd Edition

Miguel Grinberg

Publisher Resources

ISBN: 0596008651Supplemental ContentErrata Page