Select to view content in your preferred language

Query offline geodatabase: wrong results using SpatialQueryFilter properties SpatialRelationship and MaxRecordCount

1022
2
03-05-2018 02:50 AM
KarinGisperg1
Emerging Contributor

Dear Esri Team!

 

We implemented a query on an offline point feature layer (from a previously downloaded geodatabase) using

 

var query = new SpatialQueryFilter

            {

                                               // Geometry geom is a polygon geometry from the sketch editor

                                                Geometry = geom,

                                               SpatialRelationship = SpatialRelationship.Intersects,

            };

                                                                                             

  var res = await featureTable.QueryFeaturesAsync(query);

 

according to the Esri samples.

 

We don't understand how the properties SpatialRelationship and MaxRecordCount work.

 

1) for polygon / polyline FL the property SpatialRelationship.Intersects returns the results as expected– this is OK.

 

2) But while using  the property SpatialRelationship.Intersects for point FL, a strange behaviour occurs. If we additionally use the query.MaxRecordCount=300 property, the query returns a subset of (arbitrary?) points within the geometry, but without exceeding the limit. In this area there are almost 4000 points, but it returns for example only 243 points, and the result object returns res.IsTransferLimitExceeded = false; We expected an result with exactly 300 features, and res.IsTransferLimitExceeded = true;

If we repeat the query with the same geometry and without the query.MaxRecordCount limit, everthing seems to be alright and 2497 features are returned.

 

3) We tried the  SpatialRelationship.EnvelopeIntersects for point feature layers then,  and the results concerning the limit seem to be OK.

But unfortunately another odd error happens: It is not just that all points in the given geometry (and its extent) are returned, but even the points that have been moved far outside this geometry (+extent) in a previous step. This is quite strange. The same behavior, if you use SpatialRelationship.Contains for example. Only using the property SpatialRelationship.Intersects  returns the correct results in this case.

 

So whatever we use, the results aren't correct. In one case too few points, in the other too many (and outside the geometry).

We use ArcGIS Runtime 100.1.0 (and 100.2.0), ArcGIS Server 10.6, .NET Framwork 4.5.2, VS 2015, Windows 10

 

Thanks in advance,

Karin

0 Kudos
2 Replies
AnttiKajanus1
Deactivated User

Hi,

Do you have a reproducer for this one? The SpatialQueryFilter that you mention is from 10.2 product family but you mention that you use 100.X family. Could you confirm which one are you using?

0 Kudos
KarinGisperg1
Emerging Contributor
Hi,
Our problem concerns the 100.x family.
I'm sorry for the confusion. We are using a kind of "SpatialQueryFilter" mapping data class to switch between 10.2.x and 100.x Versions. That's why this "SpatialQueryFilter" object  is erroneously in the sample. We pass and apply it like this :
public static async Task<FeatureQueryResult> QueryTest(FeatureTable featureTable, SpatialQueryFilter spatialQ, int maxRecordsCount)
        {
            if (spatialQ?.Geometry != null)
            {
                FeatureQueryResult res = null;
                var qp = new QueryParameters()
                             {
                                 Geometry = spatialQ.Geometry,
                                 SpatialRelationship = spatialQ.SpatialRelationship,
                             };
                //  apply other properties too [...]
               if (maxRecordsCount > 0)
                        qp.MaxFeatures = maxRecordsCount;
               // [...]
                try
                {
                    res = await featureTable.QueryFeaturesAsync(qp);
                }
                catch (Exception e)
                {
                    //  [...]
                }
                return res;
            }
            // [...]
            return null;
        }
I' ll provide a full reproducer per mail.
Thanks in advance.
0 Kudos