ThinkGeo.com    |     Documentation    |     Premium Support

WmsRasterLayer - Server Name Reset

I have tried using the sample to connect to a WMS server and it worked fine. When I connect to my own WMS server it requires that I update the "Crs" property to a supported format, this is OK and I can get the capabilities from the server.



Debug


.WriteLine(wmsImageLayer.GetRequestUrl(winformsMap1.CurrentExtent, winformsMap1.Width, winformsMap1.Height));


The above code when using the standard sample has the server name of the sample - OK.


When I update the Crs property to



wmsImageLayer.Crs =



"EPSG:2154";

Which is the only one supported by my server then I can get the capabilities and the layer names.


 


Debug.WriteLine(wmsImageLayer.GetRequestUrl(winformsMap1.CurrentExtent, winformsMap1.Width, winformsMap1.Height));

This code reports that the server Url has been reset to "localhost" and the application cannot be found a "404 error".


What is going on? - why would the server Url be reset just by updating the Crs property?


If I don't update the Crs property then the server name is the correct one but it doesn't work because then I get "This CRS is not supported in the Wms server: "


 





 


Chris,
 
Welcome to ThinkGeo’ world!
 
From your description I can not find any reason caused that problem, so I need your corporation to figure out what happened.
 
Can I get the version of the Desktop Edition you are on, you can get this by calling the GetVersion on the Winforms Map control.
Do you use WmsRasterLayer as your wmsImageLayer, or extend WmsRasterLayer and override some API
Can you give me the loading code for the wms image layer so we can check them out.
Can you tell me the URL of your wms server if possible?
You use EPSG:2154, so you must project your data in your server, can you give me the code that how you project them?
You also can give me more information which you think that will be helpful.
 
Thanks.
James

Thanks for the reply have worked out the problem is with the configuration of the WMS server, it is hosted on an certain address but then uses localhost to 'advertise' (not sure of the word) where to return for GetCapabilities and GetMap, like the example shown below.


I guess this wouldn't of worked for another system we have (which was confusing me) except that was actually hosted on Citrix on the same server.


 ///<GetCapabilities>




 ///<Format>application/vnd.ogc.wms_xml</Format>


 ///<DCPType>


 ///<HTTP>


 ///<Get>


 ///<OnlineResource xmlns:xlink="w3.org/1999/xlink" xlink:type="simple" xlink:href=localhost/WebMapServiceTest/GetMap.ashx />

 ///  </Get>


 ///  </HTTP>


 ///  </DCPType>


 ///  </GetCapabilities>

 



Chris, 
  
 You’re right, the result Url of GetRequestUrl method is according to attribute of OnlineResource. And this Url will be used to GetCapabilities and GetMap. 
  
 Please let me know if you still have problem. 
  
 Thanks 
 James