Brutile layer

Dec 8, 2010 at 1:25 PM

Hi Paul/Brutile team

I have a created a layer by javascript and openlayers, now I want to call the same layer using sharpmap.

I am using openlayers map with follwing code.

 <html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>MapServer Layer</title>
    <style type="text/css">
        #map
        {
            width: 800px;
            height: 475px;
            border: 1px solid black;
        }
    </style>
    <script type="text/javascript" src="http://openlayers.org/dev/OpenLayers.js"></script>
    <script type="text/javascript">
        var map, layer;

        function init() {
            map = new OpenLayers.Map('map');
            layer = new OpenLayers.Layer.MapServer("OpenLayers WMS",
       "http://demo.mapserver.org/cgi-bin/wms", { layers: 'continents' });
            map.addLayer(layer);
            map.zoomToMaxExtent();
        }
        
    </script>
</head>
<body onload="init()">
    <div id="map">
    </div>
</body>
</html>
 
Note:the above  code is working fine. and I am getting map as well as layer.

but now I am calling same layer, but with sharp map  I am using this below code. 

string wmsUrl = "http://demo.mapserver.org/cgi-bin/wms";
                WmsLayer layWms = new WmsLayer("WMS", wmsUrl);
                layWms.AddLayer("continents");                 
                layWms.SetImageFormat(layWms.OutputFormats[3]);
                //Map Server Transparancy 
                layWms.Transparancy = true;           
                layWms.SetImageFormat("image/png");
                layWms.ContinueOnError = false;
                layWms.BgColor = System.Drawing.Color.Red;
                layWms.Enabled = true;
                //Set timeout to 5 seconds
                layWms.TimeOut = 5000;
                //Map Server Projection ID            
                layWms.SRID = 4326;
                map.Layers.Add(layWms);
                map.ZoomToBox(layWms.Envelope);   
                map.ZoomToExtents();
the map and layer is not coming, what I am doing wrong?
Please guide me to do this?
thanks for the help,.