Код: Выделить всё
MAP
NAME "WMS"
STATUS ON
IMAGETYPE PNG
EXTENT 0.05 0.17 0.15 0.18
SIZE 400 300
SHAPEPATH "/ms4w/Apache/example/shp/"
UNITS DD
IMAGECOLOR 255 255 255
WEB
TEMPLATE "template.html"
IMAGEPATH "/ms4w/Apache/example/shp/tmp/"
IMAGEURL "/tmp/"
METADATA
wms_title "GIS-LAB Demo"
wms_abstract "This is the WMS demo from GIS-Lab"
wms_onlineresource
"http://localhost/cgi-bin/mapserv.exe?map=/ms4w/Apache/example/nsk.map&"
wms_srs "EPSG:4326"
wms_getfeatureinfo
"http://localhost/cgi-bin/mapserv.exe?map=/ms4w/Apache/example/nsk.map&"
wms_featureinfoformat "text/plain"
END
END
PROJECTION
"proj=latlong"
"ellps=WGS84"
"datum=WGS84"
END
LAYER # States polygon layer begins here
NAME map1
DATA nsk
STATUS ON
TYPE POLYGON
TEMPLATE "dummy"
PROJECTION
"proj=latlong"
"ellps=WGS84"
"datum=WGS84"
END
CLASS
NAME "States"
STYLE
COLOR 232 232 232
END
END
METADATA
wms_title "Countries 1"
wms_abstract "Countries 1 test"
wms_srs "EPSG:4326"
wms_include_items "all"
END
END
END
Код: Выделить всё
<html>
<head>
<title>OpenLayers Example</title>
<script
src="OpenLayers-2.8/OpenLayers.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://localhost/example/nsk", {layers: 'map1'} );
map.addLayer(wms);
map.zoomToMaxExtent();
</script>
</body>
</html>