Hi,<br><br>I'm a new user of Mapserver and am having a hard time with getting layers from a new mapfile to load in OpenLayers. I've tested that my local mapserver install is responding correctly to WMS requests, and it seems to work correctly. Here is the request, with some linebreaks for clarity;<br>
<br><a href="http://localhost/cgi-bin/mapserv?map=/var/www/520_webmap/mapfiles/520_ECP.map">http://localhost/cgi-bin/mapserv?map=/var/www/520_webmap/mapfiles/520_ECP.map</a><br>&SERVICE=WMS<br>&version=%221.1.122<br>
&REQUEST=GetMap<br>&LAYERS=Wetlands<br>&STYLES=<br>&BBOX=775843.302946,602429.871045,848438.746010,635418.446144<br>&WIDTH=600<br>&HEIGHT=400<br>&FORMAT=png<br>&SRS=epsg:2286<br><br>This returns an image that contains all of the layers which are active at the scale of the BBOX area. However, I cannot seem to find the right syntax to get the layer to load into OpenLayers. I have taken one of the test.html files, the one for a single wms, and have tested that it works with my openlayers.js install. This is that file:<br>
-----------------------<br><html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"><br> <head><br> <title>OpenLayers Basic Single WMS Example</title><br>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" /><br> <style type="text/css"><br> #map {<br> width: 512px;<br> height: 512px;<br>
border: 1px solid black;<br> }<br> </style><br> <script src="<a href="http://localhost:8080/geoserver/www/openlayers/OpenLayers.js">http://localhost:8080/geoserver/www/openlayers/OpenLayers.js</a>"></script><br>
<script type="text/javascript"><br> var map, layer;<br> function init(){<br> map = new OpenLayers.Map( 'map' );<br> layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br>
"<a href="http://labs.metacarta.com/wms/vmap0">http://labs.metacarta.com/wms/vmap0</a>",<br> {layers: 'basic'} );<br> map.addLayer(layer);<br> map.zoomToMaxExtent();<br>
}<br> </script><br> </head><br> <body onload="init()"><br> <h1 id="title">Basic Single WMS Example</h1><br><br> <div id="tags"></div><br>
<br> <div id="shortdesc">Show a Simple Map</div><br><br> <div id="map"></div><br><br> <div id="docs"><br> This example shows a very simple layout with minimal controls. This example uses a single WMS base layer.<br>
</div><br> </body><br></html><br>------------------------------<br><br>No matter how I edit the file though, when I point to my localhost mapserver instance, I just get an empty map frame, with no map controls, or anything inside of it. Right now the layer portion looks like this:<br>
<br> <script type="text/javascript"><br> var map, layer;<br> function init(){<br> map = new OpenLayers.Map('map', <br> { maxExtent: new OpenLayers.Bounds(775843.302946,602429.871045,848438.746010,635418.446144), <br>
maxResolution: "auto",<br> projection:"SRS_not_defined" <br> } );<br> layer = new OpenLayers.Layer.WMS( '520_WebMap', <br>
"<a href="http://localhost/cgi-bin/mapserv">http://localhost/cgi-bin/mapserv</a>?",<br> { layers: 'Wetlands', <br> map: 'map=/var/www/520_webmap/mapfiles/520_ECP.map',<br>
format: 'image/png',<br> request: 'getmap',<br> transparent: "false"<br>
});<br> map.addLayer(layer);<br> map.zoomToMaxExtent();<br> </script><br><br>I'm hoping one of you has encountered a similar problem and can give me some advice for how to resolve it.<br>
<br>Thanks,<br><br>Roger<br>