ThinkGeo.com    |     Blog    |     Wiki    |     Support

WFS WfsFeatureLayer WFS server version is not determined by the layer or no way to set the version number

Dear Sir/Madam,

We are using thinkgeo mapsuite 9.xxx for WPF. We have some problem with the WFS feature layer. We could not find a way to advice the layer to which version of wfs server we are connecting. As it apprears with basic settings, it requests with version 1.0.0.0(we saw through wfsFeatureLayer.SentWebRequest event) where as the wfs server can be of version 1.1(which is in our case, and our wfs only supports v.1.1) or even higher. Please help.



In case you need the server url please write me a mail. As the wfs server url is from one of our client!

Kind regards.

Murshed

Hi Murshed,  
  
 I have replied you in your ticket.  
  
 Regards,  
  
 Don

Hello,

I have the same problem and can not find a solution how I can pass the server version, SRSName and MaxFeatures to a WFS.

I am using latest version of MapSuite for WPF and access the WFS via WfsFeatureLayer.

My Code:

var layer = new WfsFeatureLayer(https://www.wfs.nrw.de/geobasis/wfs_nw_dvg, dvg:nw_dvg2_rbz);
layer.Open();

My goal is to target a specific WFS version e.g 1.1.0 and also pass the SRSName.

e.g.
https://www.wfs.nrw.de/geobasis/wfs_nw_dvg?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=dvg:nw_dvg2_rbz&maxfeatures=200&SRSNAME=EPSG:4326

Regards,

Artur Osmanov

Hi Artur,

Our WFSFeature layer only support version 1.0.0, so all the sending request default contains the parameters: “?SERVICE=WFS&VERSION=1.0.0&”.

And if you set correct serviceLocationUrl, the get feature function will looks like: “?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature”.

And we have an event “SendingWebRequest”, the parameter of it is the WebRequest, so you can modify the sending URI in this event, you can add, delete or modify the parameter in it follow your requirement.

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,

thank you for your reply. I was able to replace the version before sending the request to the WFS but that does not solve my problem because the WfsFeatureLayer/WfsFeatureSource is hardcoded for version 1.0.0 and I am not able to get e.g the bounding box (exception while overlay.GetBoundingBox() call) or any features. I suppose the layer is not able to parse newer gml version.

The only solution I see right now is to implement new WfsFeatureLayer and WfsFeatureSource to handle newer versions. Is that right?

Do you plan to update the WfsFeaturelayer to enable support for newer WFS?

My Code:

 layer.SendingWebRequest += (sender, args) =>
            {
                var uri = args.WebRequest.RequestUri;

                var parameter = HttpUtility.ParseQueryString(uri.Query);
                parameter["VERSION"] = "1.1.0";

                if (parameter.Get("REQUEST").Equals("GetFeature"))
                {
                    parameter.Add("SRSNAME", "EPSG:4326");
                }

                var builder = new UriBuilder(uri) { Query = parameter.ToString() };

                var modRequest = WebRequest.Create(builder.Uri);
                args.WebRequest = modRequest;
            };

            layer.Open();
            var bb = layer.GetBoundingBox();
            var count = layer.QueryTools.GetCount();

Regards,
Artur

Hi Artur,

Yes, I think the solution is implement a new version wfslayer and wfssource for version 1.1.0 and 2.0.0, because the logic is work for version 1.0.0 currently.

And I checked your question to our developer, we don’t have the plan to support newer version WFS in near future.

So if you met any question when override the functions please let us know.

Regards,

Ethan