ThinkGeo.com    |     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 = "https://geodata.nationaalgeoregister.nl/kadastralekaart/wfs/v4_0";
        const string typeName = "openbareruimtenaam";
        var featureSource = new WfsFeatureSource(serviceLocationUrl, typeName);
        featureSource.Open();

        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.

GetFeaturesInsideBoundingBox:
https://geodata.nationaalgeoregister.nl/kadastralekaart/wfs/v4_0?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=openbareruimtenaam&BBOX=25001,388933,25002,388934&propertyname=plaatsingspunt,id,objectBeginTijd,LV-publicatiedatum,relatieveHoogteligging,inOnderzoek,tijdstipRegistratie,identificatieNamespace,identificatieLokaalID,bronhouder,bgt-status,plus-status,identificatieBAGOPR,tekst,hoek,openbareRuimteType

GetFeatureById:
https://geodata.nationaalgeoregister.nl/kadastralekaart/wfs/v4_0?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&request=GetFeature&FeatureId=openbareruimtenaam.004e2cf5-2396-497f-a7b7-ce172e044dc0
(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.

Thanks,
Leo