I've run into a strange issue with the use of ServiceFeatureTable.QueryFeaturesAsync() in .Net Runtime 100.13.
I currently have some code that looks like this:
QueryParameters parameters = new QueryParameters
{
Geometry = selectionGeometry,
SpatialRelationship = SpatialRelationship.Intersects,
ReturnGeometry = true,
OutSpatialReference = new SpatialReference(102100),
MaxAllowableOffset = 0.5
};
return await ServiceFeatureTable.QueryFeaturesAsync(parameters, QueryFeatureFields.LoadAll);
And if the selectionGeometry is an envelope the request coming out of the application in Fiddler is changing the spatial relationship in the request to esriSpatialRelEnvelopeIntersects instead of submitting it as esriSpatialRelIntersects. This is causing issues becuase it is returning too many features.
This is what the request coming out of the application looks like. (paths omitted due to sensitive data):
GET https://portalserver/rest/services/FeatureLayer/MapServer/0/query?f=json&geometry={"xmin":-10862928.215694556,"ymin":6103526.6903118202,"xmax":-10862918.214113874,"ymax":6103536.6918925019}&geometryType=esriGeometryEnvelope&inSR=3857&maxAllowableOffset=0.5&outFields=*&outSR=3857&returnDistinctValues=false&returnGeometry=true&returnM=true&returnZ=true&spatialRel=esriSpatialRelEnvelopeIntersectsIf I change the query to use PopulateFromServiceAsync like this:
return await ServiceFeatureTable.PopulateFromServiceAsync(parameters, false, new List<string> { "*" }); The request that comes across in Fiddler with a SpatialRelationship set to esriSpatialRelIntersects and executes appropriately.
This is what that request looks like in Fiddler:
GET https://portalserver/rest/services/FeatureLayer/MapServer/0/query?f=json&geometry={"xmin":-10862793.19435535,"ymin":6103651.7100703456,"xmax":-10862783.192774668,"ymax":6103661.7116510272}&geometryType=esriGeometryEnvelope&inSR=3857&maxAllowableOffset=0.5&outFields=*&outSR=3857&returnDistinctValues=false&returnGeometry=true&returnM=true&returnZ=true&spatialRel=esriSpatialRelIntersectsThe issue is the performance of that method is much slower than QueryFeaturesAsync due to skipping the local cache. So I need to be able to use QueryFeaturesAsync.
Is there some way I can get QueryFeaturesAsync to request the correct spatial relationship? Or is this a runtime bug?