直接访问本机的MapServer服务器可以正确看到地图,
但,使用OpenLayer写个简单的页面却看不到地图,请指教哇。
用IE直接访问MapServer可以显示地图
sz.map 内容如下:
# Map file created from QGIS project file
# Edit this file to customize for your map interface
# (Created with PyQgis MapServer Export plugin)
MAP
NAME "QGIS-MAP"
# Map image size
SIZE 600 400
UNITS dd
EXTENT 114.055799 22.537858 114.108519 22.561268
FONTSET './fonts/fonts.txt'
SYMBOLSET './symbols/symbols.txt'
PROJECTION
'proj=longlat'
'datum=WGS84'
'no_defs'
END
# Background color for the map canvas -- change as desired
IMAGECOLOR 255 255 255
IMAGEQUALITY 95
IMAGETYPE png
OUTPUTFORMAT
NAME png
DRIVER 'GD/PNG'
MIMETYPE 'image/png'
IMAGEMODE RGBA
EXTENSION 'png'
END
# Legend
LEGEND
IMAGECOLOR 255 255 255
STATUS ON
KEYSIZE 18 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END
END
# Web interface definition. Only the template parameter
# is required to display a map. See MapServer documentation
WEB
# Set IMAGEPATH to the path where MapServer should
# write its output.
IMAGEPATH '/tmp/'
# Set IMAGEURL to the url that points to IMAGEPATH
# as defined in your web server configuration
IMAGEURL '/tmp/'
# WMS server settings
METADATA
'ows_title' 'QGIS-MAP'
'ows_onlineresource' 'http://127.0.0.1/cgi-bin/mapserv.exe?map=C:/OSGeo4W/apache/htdocs/SZMAP/sz.map'
'ows_srs' 'EPSG:4326'
END
#Scale range at which web interface will operate
# Template and header/footer settings
# Only the template parameter is required to display a map. See MapServer documentation
TEMPLATE 'fooOnlyForWMSGetFeatureInfo'
END
LAYER
NAME 'region'
TYPE POLYGON
DUMP true
TEMPLATE fooOnlyForWMSGetFeatureInfo
EXTENT 114.055799 22.537858 114.108519 22.561268
DATA './region.shp'
METADATA
'ows_title' 'region'
END
STATUS OFF
TRANSPARENCY 100
PROJECTION
'proj=longlat'
'datum=WGS84'
'no_defs'
END
CLASS
NAME 'region'
STYLE
WIDTH 0.91
OUTLINECOLOR 0 0 0
COLOR 103 170 188
END
END
END
LAYER
NAME 'polyline'
TYPE LINE
DUMP true
TEMPLATE fooOnlyForWMSGetFeatureInfo
EXTENT 114.055799 22.537858 114.108519 22.561268
DATA './polyline.shp'
METADATA
'ows_title' 'polyline'
END
STATUS OFF
TRANSPARENCY 100
PROJECTION
'proj=longlat'
'datum=WGS84'
'no_defs'
END
CLASS
NAME 'polyline'
STYLE
WIDTH 0.91
COLOR 162 139 23
END
END
END
END