ThinkGeo.com    |     Documentation    |     Premium Support

Image is null in RasterLayer.DrawCore for WMS layer

I am using the WmsRasterLayer in the Desktop 3.0 edition to call a WMS service. This service works with no problems when I call it via the WmsRasterLayer in the Web 3.0 edition. However, in the desktop edition I get the following error:


The parameter you supplied may not be null.

Parameter name: image


And here's the stack trace:


   at ThinkGeo.MapSuite.Core.Validators.CheckParameterIsNotNull(Object objectToTest, String parameterName)

   at ThinkGeo.MapSuite.Core.GeoCanvas.DrawWorldImageWithoutScaling(GeoImage image, Double centerXInWorld, Double centerYInWorld, DrawingLevel drawingLevel)

   at ThinkGeo.MapSuite.Core.RasterLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)

   at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)

   at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)

   at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)

   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x5e1f8125aa040824(Object x2680f14bfcc5c488)

   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x958228b8a7148f83()

   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a)

   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()

   at CSharpWinformsSamples.LoadAWmsImage.DisplaySatelliteImage_Load(Object sender, EventArgs e) in C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Samples\CSharp Winforms How Do I Samples\Satellite image\LoadAWmsImage.cs:line 54


As you can see, the error occurs in the sample program, when the map is refreshed.


As I mentioned, this WMS service works fine when using the web edition. Also, when I debug I see that the WMS service is writing an image to the response buffer.


Thanks!



Gregory, 



Which version of Desktop Edition are you using, it is 3.0.362? 



Can you provide us the URL for your WMS service? And just make sure the only change for your test code is changing the URL in the LoadAWmsImage HowDoI sample? And this exception will always happen when we open the HowDoI sample? 



Any more information would be appreciated. 



Thanks. 



Yale 

 



Yes, I am running 3.0.362, and yes, the only change I made was to the URL. The URL I pointed to is the URL of my own WMS service. That service is returning an image to the requestor. 
  
 This same URL and WMS service works fine for the web edition, but as soon as I point the desktop edition to the URL the error shows up. Any thoughts?

Gregory,


Thanks for your reporting! I think we can fix this potential problem in our product somehow.
 
While currently, you can go around this problem by changing a bit in the WMS server side if you can:
 
Now, your returning response ContentType is text/html, while it should be image/png or image/jpeg:

Response.ContentType = "image + webMapServiceGetMapRequest.ImageFormat.ToString();

 

Any more questions please feel free to let me know.
Thanks.
 
Yale


Yale, thanks for your reply. I implemented your suggestion and the problem vanished! Thank you so much for your guidance…

Gregory, 
  
 My pleasure! 
  
 Any more questions please feel free to let me know. 
  
 Thanks. 
  
 Yale