Thanks for raising this up, it’s proved to be a bug in the SDK, it has been fixed now, I’m not sure what .NET version you are working on, if .NET Framework, please get the latest ThinkGeo.MapSuite.Layers.Wms with versions higher than or equal to 11.0.0-beta018, if .NET Core, please get the latest ThinkGeo.Core with versions higher than or equal to 13.0.0-beta054 to get it fixed.
Getting closer. Now I get the following error when trying to use GetFeatureInfo.
System.InvalidOperationException
HResult=0x80131509
Message=Invalid value for INFO_FORMAT: text/xml
Source=ThinkGeo.MapSuite.Layers.Wms
StackTrace:
at ThinkGeo.MapSuite.Layers.WmsRasterSource.HandleResponseCore(WebRequest request)
at ThinkGeo.MapSuite.Layers.WmsRasterSource.GetFeatureInfoCore(ScreenPointF screenPointF, String infoFormat, Int32 maxFeatures)
at ThinkGeo.MapSuite.Layers.WmsRasterLayer.GetFeatureInfo(ScreenPointF screenPointF, String infoFormat, Int32 maxFeatures)
at ThinkGeo.MapSuite.Layers.WmsRasterLayer.GetFeatureInfo(ScreenPointF screenPointF)
at WMS_v10.Form1.WinformsMap1_MapClick(Object sender, MapClickWinformsMapEventArgs e) in C:\Users\damian\OneDrive - acteq.net\Visual Studio Projects\Projects\WMS_v10\WMS_v10\Form1.cs:line 102
at ThinkGeo.MapSuite.WinForms.WinformsMap.OnMapClick(MapClickWinformsMapEventArgs e)
at ThinkGeo.MapSuite.WinForms.WinformsMap.M1M=(InteractionArguments interactionArguments)
at ThinkGeo.MapSuite.WinForms.WinformsMap.J1M=(Object sender, WFM= e)
at ThinkGeo.MapSuite.WinForms.MouseEventAnalyzer.OnMouseEvent(WFM= e)
at ThinkGeo.MapSuite.WinForms.MouseEventAnalyzer.VFM=(Double screenX, Double screenY, Double worldX, Double worldY)
at ThinkGeo.MapSuite.WinForms.WinformsMap.KlM=(Object sender, MouseEventArgs e)
at System.Windows.Forms.MouseEventHandler.Invoke(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WMS_v10.Program.Main() in C:\Users\damian\OneDrive - acteq.net\Visual Studio Projects\Projects\WMS_v10\WMS_v10\Program.cs:line 19
Cool! Demain, the service has been authorized now, the problem is that the WMS service requested doesn’t support “text/xml” as “INFO_FORMAT”, “text/xml” is the default “GetFeatureInfo” format in ThinkGeo SDK, it’s hard-code in method “GetFeatureInfo(ScreenPointF screenPointF)”.
The parameter “INFO_FORMAT” is a mandatory parameter indicates what format to use when return feature information. Supported values for a GetFeatureInfo request on a WMS server are listed as MIME types in one or more <Request><FeatureInfo><Format> elements of its service metadata. The entire MIME type string in is used as the value of the INFO_FORMAT parameter. To get the detail of the metadata, please visit the link “http[s]://[service host]?version=1.3.0&service=wms&request=GetCapabilities” (Given the WMS service is 1.3.0, it may be 1.1.1 sometimes) in browser or call the method “GetServerCapabilitiesXml” of “WmsRasterSource”. Then we can see what “INFO_FORMAT” supported on service. Once determined what “INFO_FORMAT” supported, please use method “GetFeatureInfo(ScreenPointF screenPointF, string infoFormat)” or “GetFeatureInfo(ScreenPointF screenPointF, string infoFormat, int maxFeatures)” instead.
So I’ve found the info format now and put that in and I don’t get any errors anymore. One step closer.
However, the GetFeatureInfo object that is returned never has any entries.
I took a look at the sending web request uri that is formed from the call and that definitely works. It’s like the object isn’t assigned when it’s returned.
For the moment, I’m just taking the web request uri and parsing it out with a WebClient DownloadString function, so I am good, but I gather there may be another bug in the GetFeatureInfo function and it would be nice to have it working directly.
I appreciate your feedback, that’s true, it’s a bug in SDK, the method GetFeatureInfo only supports “text/xml” now, I have submit the issue to internal task tracking system, developers can dig into further later. Good news is that it doesn’t delay your development. Thanks a lot again.