[OpenLayers-Users] question about example files

Brenningmeyer, Todd tbrenningmeyer at maryville.edu
Sun Apr 27 17:06:03 EDT 2008


Hello,
I am trying to display data from mapserver using openlayers and am using the example files as a reference.  I'm using ms4w and the mapserver.html example file with Open-layers2.5.  When I view the file it displays pink tiles but none of the layers.  The error that is listed when I open the pink tiles reads:  loadMap(): Web application error. CGI variable "map" is not set.  I'm not quite sure what the problem is but any help is appreciated.  I'll paste the mapserver.html file below with the altered sections in red.  I have been able to get an image to display when I add the rest of the wms request to the section that has mapserver.exe listed (I used http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apache/htdocs/maryville_web/maryville.map&SERVICE=WMS in place of http://localhost/cgi-bin/mapserv.exe)
If you have any suggestions I would appreciate your help.
Thanks,
Todd
 
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <style type="text/css">
        #map {
            width: 800px;
            height: 475px;
            border: 1px solid black;
        }
    </style>
    <script src="OpenLayers-2.5/lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var lon = 818500;
        var lat = 1024080;
        var zoom = 0;
        var map, layer;
        function init(){
            map = new OpenLayers.Map( 'map' );
            layer = new OpenLayers.Layer.MapServer( "Maryville Campus", 
                    "http://localhost/cgi-bin/mapserv.exe <http://localhost/cgi-bin/mapserv.exe> ", {layers: 'maryville_bldgs'},
                    {gutter: 15});
            map.addLayer(layer);
            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
        }
        
    </script>
  </head>
  <body onload="init()">
    <div id="map"></div>
  </body>
</html>




More information about the Users mailing list