[mapserver-users] Changing to Layers.WMS from Layers.Mapserver
Paul Curran
paul_everton at hotmail.com
Fri Jul 17 04:13:01 PDT 2009
Hi, i am having trouble trying to display my map in Open Layers via OpenLayers.Layer.wms.
Firstly I Built a shape file of the UK as a raster tileindex. I can now view my map via "//localhost/cgi-bin/mapserv.exe/mymapfile.map" and the map looks fine.
I am now trying to view my map via OpenLayers. Firstly I used Openlayers.Layer.MapServer which displayed my map however zoomed in very close. However I have read Layer.Mapserver should be avoided and Layer.WMS should be used instead.
I attempted to amend both my map and openlayers files to display via WMS by
Including:
METADATA
‘wms_srs’ “EPSG: 32119 EPSG: 4326”
END
within the WEB section of my map file and adding OpenLayers.WMS within my OpenLayers file.
However I now get the following error message within the openlayers map window “msWMSLoadGetMapParams(): WMS Server Error”
I also added ‘projection: "epsg: 32119 epsg:4326” into my openlayers file which hasn’t made any difference
Does anyone have any idea where I am going wrong? Any help greatly appreciated. My map and openlayers files are below.
Cheers
p.s. I ahve installed ms4w on windows which i tihnk supports WMS
MAP
NAME UK1
SIZE 1600 1200
IMAGECOLOR 153 204 255
IMAGETYPE JPEG
SHAPEPATH "http://localhost/openlayers/data/"
EXTENT -888385.321101 -31000.000000 1548385.321101 1271000.000000
UNITS METERS
WEB
TEMPLATE "http://localhost/openlayers/examples/test.html"
LOG "\ms4w\tmp\ms_tmp\log.txt"
IMAGEPATH "\ms4w\tmp\ms_tmp\"
IMAGEURL "/ms_tmp/"
METADATA
'wms_srs' "epsg: 32119 epsg: 4326"
END
END
LAYER
NAME "UK"
STATUS DEFAULT
TYPE raster
TILEINDEX "map"
TILEITEM "Location"
CLASS
STYLE
COLOR 0 0 0
END
LABEL
COLOR 0 0 0
SIZE SMALL
END
END
END
END
<html xmlns="http://www.w3.org/1999/xhtml">
<head>NARIMS MAPPING TEST
<style type="text/css">
#map {
width: 95%;
height: 95%;
border: 10px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var zoom = 1;
var bounds = new OpenLayers.Bounds(-888385.321101, -31000.000000, 1548385.321101, 1271000.000000);
var map, layer;
function init(){
map = new OpenLayers.Map('map', { maxExtent: bounds });
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.OverviewMap());
map.addControl(new OpenLayers.Control.MousePosition());
layer = new OpenLayers.Layer.WMS ( "OpenLayers WMS",
"http://127.0.0.1/cgi-bin/mapserv.exe?", { layers: 'basic', map: '/ms4w/apps/openlayers-2.5/data/uk1.map', projection: "epsg “32119 epsg:4326" },
{ gutter: 15 });
map.addLayer(layer);
map.zoomToExtent(bounds);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>
_________________________________________________________________
Share your photos with Windows Live Photos – Free.
http://clk.atdmt.com/UKM/go/134665338/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090717/3be1b2f5/attachment.htm>
More information about the MapServer-users
mailing list