[OpenLayers-Users] using mapserver in openlayers

new2ms4w nagal005 at umn.edu
Sat Feb 14 01:06:51 EST 2009


Hello Everyone,


I'm trying to use the OpenLayers.Layer.MapServer class to get a mapfile onto
my OpenLayers html page. The image from the mapfile wasn't displaying. 
So, I tried to add the map data using the OpenLayers.Layer.WMS class. That
attempt also failed.
I think there is something fundamentally wrong I'm doing.


Below is the code for both the mapfile and the html page. Please help me
out. I've been grappling with this for more than 4 hours now. :-((

------------------------------------------
The mapfile is called Roads.map
MAP
  SIZE 600 300
  EXTENT -123 23 -66 50
  IMAGECOLOR 180 180 250
  IMAGETYPE PNG
  UNITS DD

  WEB
    TEMPLATE global.html
    IMAGEPATH "/ms4w/tmp/ms_tmp/"
    IMAGEURL "/ms_tmp/"
  END

  LAYER
    NAME roads
    TYPE LINE
    STATUS DEFAULT
    DATA roads
  END
END

---------------------------------
Below is my init() function inside the html page.


            function init(){
                var options = {
                    controls: [new OpenLayers.Control.KeyboardDefaults()]
                };
                map = new OpenLayers.Map('map', options);
		var mps = new OpenLayers.Layer.MapServer(
		"OpenLayers MPS",
		"http://localhost/cgi-bin/mapserv.exe",
		{map: '\\ms4w\\apache\\htdocs\\shapedata\\roads.map'}
		);

		map.addLayer(mps);
                map.zoomToMaxExtent();
            }



Thank you for your time.

~PN
-- 
View this message in context: http://n2.nabble.com/using-mapserver-in-openlayers-tp2325393p2325393.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list