2,143
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers Tutorial - Basic Map Setup</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map, baseLayer;
function init(){
map = new OpenLayers.Map("map");
layer = new OpenLayers.Layer.MapServer( "region",
"http://127.0.0.1/cgi-bin/mapserv.exe",
{map: 'C:/OSGeo4W/apache/htdocs/SZMAP/sz.map'});
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(114,22));
}
</script>
<style>
@media screen
{
#map{width: 500px; height:250px; border: 2px solid black;}
}
</style>
</head>
<body onload="init()">
<h3>OpenLayers Tutorial - Basic Map Setup</h3>
<div id="map"></div>
</body>
</html>
# 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