根据您选择的格式,图像可能不会显示在您的浏览器。如果链接无法显示在您的浏览器中,右键单击上图中,看一下 MapFile 中指定何种保存格式。
下面是本例中使用的Mapfile ( mfa8.map
):
01 MAP
02 EXTENT -180 -90 180 90
03 SIZE 600 300
04 SHAPEPATH "/gdata"
05 IMAGECOLOR 0 0 255
06 FONTSET "../fonts/fonts.list"
07 SYMBOLSET "../symbols/symbols35.sym"
08 IMAGETYPE "PNG24"
09 OUTPUTFORMAT
10 NAME "png8"
11 DRIVER "AGG/PNG8"
12 MIMETYPE "image/png; mode=8bit"
13 IMAGEMODE RGB
14 EXTENSION "png"
15 FORMATOPTION "QUANTIZE_FORCE=on"
16 FORMATOPTION "QUANTIZE_COLORS=256"
17 FORMATOPTION "GAMMA=0.75"
18 END
19 OUTPUTFORMAT
20 NAME "png"
21 DRIVER "AGG/PNG"
22 IMAGEMODE RGB
23 END
24 OUTPUTFORMAT
25 NAME "png24"
26 DRIVER "AGG/PNG"
27 IMAGEMODE RGBA
28 TRANSPARENT TRUE
29 END
30 OUTPUTFORMAT
31 NAME "jpeg"
32 DRIVER "AGG/JPEG"
33 IMAGEMODE RGB
34 END
35 OUTPUTFORMAT
36 NAME "svg"
37 DRIVER "CAIRO/SVG"
38 MIMETYPE "image/svg+xml"
39 IMAGEMODE RGB
40 EXTENSION "svg"
41 END
42 OUTPUTFORMAT
43 NAME "pdf"
44 DRIVER "CAIRO/PDF"
45 MIMETYPE "application/x-pdf"
46 IMAGEMODE RGB
47 EXTENSION "pdf"
48 END
49 OUTPUTFORMAT
50 NAME "cairopng"
51 DRIVER "CAIRO/PNG"
52 MIMETYPE "image/png"
53 IMAGEMODE RGB
54 EXTENSION "png"
55 END
56 OUTPUTFORMAT
57 NAME "GTiff"
58 DRIVER "GDAL/GTiff"
59 MIMETYPE "image/tiff"
60 IMAGEMODE RGB
61 EXTENSION "tif"
62 END
63 LAYER
64 NAME "topo"
65 DATA "land_shallow_topo_8192.tif"
66 STATUS OFF
67 TYPE RASTER
68 END
69 LAYER
70 NAME "wcountry-line"
71 DATA "wcountry.shp"
72 STATUS OFF
73 TYPE LINE
74 CLASS
75 NAME "State Boundary"
76 STYLE
77 SYMBOL "line5"
78 COLOR 255 255 0
79 SIZE 1
80 END
81 END
82 END
83 END
f | 1 | MAP | f | 1 | MAP |
n | n | 2 | EXTENT -180 -90 180 90 | ||
3 | SIZE 600 300 | ||||
4 | SHAPEPATH "/gdata" | ||||
5 | IMAGECOLOR 0 0 255 | ||||
6 | FONTSET "../fonts/fonts.list" | ||||
7 | SYMBOLSET "../symbols/symbols35.sym" | ||||
2 | IMAGETYPE "PNG24" | 8 | IMAGETYPE "PNG24" | ||
n | 3 | EXTENT -20042150 -7515806 20104978 7515807 | n | 9 | OUTPUTFORMAT |
4 | SIZE 350 260 | 10 | NAME "png8" | ||
5 | SHAPEPATH "/gdata" | 11 | DRIVER "AGG/PNG8" | ||
6 | SYMBOLSET "../symbols/symbols35.sym" | 12 | MIMETYPE "image/png; mode=8bit" | ||
7 | FONTSET "../fonts/fonts.list" | 13 | IMAGEMODE RGB | ||
8 | PROJECTION | 14 | EXTENSION "png" | ||
9 | "init=epsg:3857" | 15 | FORMATOPTION "QUANTIZE_FORCE=on" | ||
16 | FORMATOPTION "QUANTIZE_COLORS=256" | ||||
17 | FORMATOPTION "GAMMA=0.75" | ||||
18 | END | ||||
19 | OUTPUTFORMAT | ||||
20 | NAME "png" | ||||
21 | DRIVER "AGG/PNG" | ||||
22 | IMAGEMODE RGB | ||||
23 | END | ||||
24 | OUTPUTFORMAT | ||||
25 | NAME "png24" | ||||
26 | DRIVER "AGG/PNG" | ||||
27 | IMAGEMODE RGBA | ||||
28 | TRANSPARENT TRUE | ||||
29 | END | ||||
30 | OUTPUTFORMAT | ||||
31 | NAME "jpeg" | ||||
32 | DRIVER "AGG/JPEG" | ||||
33 | IMAGEMODE RGB | ||||
34 | END | ||||
35 | OUTPUTFORMAT | ||||
36 | NAME "svg" | ||||
37 | DRIVER "CAIRO/SVG" | ||||
38 | MIMETYPE "image/svg+xml" | ||||
39 | IMAGEMODE RGB | ||||
40 | EXTENSION "svg" | ||||
41 | END | ||||
42 | OUTPUTFORMAT | ||||
43 | NAME "pdf" | ||||
44 | DRIVER "CAIRO/PDF" | ||||
45 | MIMETYPE "application/x-pdf" | ||||
46 | IMAGEMODE RGB | ||||
47 | EXTENSION "pdf" | ||||
48 | END | ||||
49 | OUTPUTFORMAT | ||||
50 | NAME "cairopng" | ||||
51 | DRIVER "CAIRO/PNG" | ||||
52 | MIMETYPE "image/png" | ||||
53 | IMAGEMODE RGB | ||||
54 | EXTENSION "png" | ||||
55 | END | ||||
56 | OUTPUTFORMAT | ||||
57 | NAME "GTiff" | ||||
58 | DRIVER "GDAL/GTiff" | ||||
59 | MIMETYPE "image/tiff" | ||||
60 | IMAGEMODE RGB | ||||
61 | EXTENSION "tif" | ||||
10 | END | 62 | END | ||
15 | TYPE RASTER | 67 | TYPE RASTER | ||
t | 16 | PROJECTION | t | 68 | END |
17 | "init=epsg:4326" | 69 | LAYER | ||
70 | NAME "wcountry-line" | ||||
71 | DATA "wcountry.shp" | ||||
72 | STATUS OFF | ||||
73 | TYPE LINE | ||||
74 | CLASS | ||||
75 | NAME "State Boundary" | ||||
76 | STYLE | ||||
77 | SYMBOL "line5" | ||||
78 | COLOR 255 255 0 | ||||
79 | SIZE 1 | ||||
80 | END | ||||
18 | END | 81 | END |
现在我们的 MapFile 包含一个新对象 OUTPUTFORMAT
。此对象定义的 MAP
对象内,和在与关键字 IMAGETYPE
一起使用。根据MapServer的编译的库,你可以有多种输出格式选择 - GD库提供 PNG
(8 - 位和24位),GIF
,JPEG
,WBMP
,GDAL库,源许多MapServer的输入格式,也可以提供输出 PNG
, JPEG
, TIFF/GeoTIFF
的,和其他栅格格式;pdflib 库提供PDF输出。
有看看通过更改关键字 IMAGETYPE
你MAPFILE的对象和实验 OUTPUTFORMAT
。应该被用作你 IMAGETYPE
的值(例如: IMAGETYPE png
或 PNG24 IMAGETYPE
),输出格式的名称。
请咨询的 OUTPUTFORMAT
对象引用: