|     Documentation    |     Premium Support

WfsFeatureSource.GetFeatureById does not work

Calling WfsFeatureSource.GetFeatureById() always returns null. The other methods to get features are OK:

        const string serviceLocationUrl = "";
        const string typeName = "openbareruimtenaam";
        var featureSource = new WfsFeatureSource(serviceLocationUrl, typeName);

        featureSource.SendingWebRequest += (_, e) => Debug.WriteLine(e.WebRequest.RequestUri);

        var features = featureSource.GetFeaturesInsideBoundingBox(new RectangleShape(25001, 388934, 25002, 388933), ReturningColumnsType.AllColumns);
        Debug.Assert(features.Count >= 1); // works

        var id = features[0].Id;
        var feature = featureSource.GetFeatureById(id, ReturningColumnsType.AllColumns);
        Debug.Assert(feature != null); // FAILS

This problem is not that the feature would not be found; the two WFS requests sent by the code above return exactly the same data.


(There are two REQUEST parameters, and TYPENAME is missing, but this is not a problem for this server.)

Apparently, GetFeatureById does something different when parsing the result.

hi Clemens,

Thanks for your detailed description. I can reproduce this issue easily.

GetFeatureById didn’t ignore the white space when parsing the XML, that’s why it always return null. I’ve fixed it in our source code. Feel free to upgrade ThinkGeo.Core to 13.0.0-beta300 or above and give it a try. The new build will take 1 or 2 days before it’s available.