ThinkGeo.com    |     Documentation    |     Premium Support

Why I can't connect the Wms?

Hi,

I want use WmsRasterLayer to connect a Wms,but it works not well. 

I use other Gis sofware (eg: Quantum GIS) to connect the Uri of the Wms ,It works well.

But when I use the thinkgeo to connect the Wms,it works not well.

the following is my code:


           winformsMap1.MapUnit = GeographyUnit.DecimalDegree;         

            winformsMap1.CurrentExtent = new RectangleShape(46.471087, 25.045243, 47.027275, 24.625307);

            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);


            WmsRasterLayer wmsImageLayer = new WmsRasterLayer(new Uri("kn-06017/cgi-bin/mymap.exe?"));

            wmsImageLayer.TimeoutInSecond = 10000;


            wmsImageLayer.UpperThreshold = double.MaxValue;

            wmsImageLayer.LowerThreshold = 0;


            wmsImageLayer.Open();

            foreach (string layerName in wmsImageLayer.GetServerLayerNames())

            {

                wmsImageLayer.ActiveLayerNames.Add(layerName);

            }


            // this parameter is just optional.

            wmsImageLayer.Exceptions = "application/vnd.ogc.se_xml";


            LayerOverlay imageOverlay = new LayerOverlay();

            imageOverlay.Layers.Add("wmsImageLayer", wmsImageLayer);

            winformsMap1.Overlays.Add(imageOverlay);

            // GetRequestUrl for debug

            winformsMap1.Refresh();


When I run my program, it throw a exception on the line  "wmsImageLayer.Open();".

the information of the exception is "can't connect to the remote server!".

Would you please help me ? I'm expecting  your reply.

thnank you very much!


 



Hi Senlin, 



First of all, we can not access the URI you supported. And from the URI I guess it is an executing program located in your machine and you want to make the exe as a WMS server, is that true? If so, how do you implement the communication between the server and client? Could you please send us your “mymap.exe” code or some sample code if possible?


And I also suggest you to install a Map Suite Service Evaluation Edition to see how the WmsFeatureSource works between client and server. There is a sample called “C# Wms Service Samples” in the ServiceEdition shows that.



Any more information is appreciated. 



Thanks, 



sun