[OpenLayers-Users] question about example files

Christopher Schmidt crschmidt at metacarta.com
Sun Apr 27 17:14:04 EDT 2008


On Sun, Apr 27, 2008 at 04:06:03PM -0500, Brenningmeyer, Todd wrote:
> 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. 

This might be because you haven't set the CGI variable "Map".
Specifically, you need to add a 'map' key/value pair to the params hash
(third arg to layer.mapserver).

-- Chris


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>
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list