AnsweredAssumed Answered

ServiceFeatureTable Where clause replacement in .NET 100.0.X arcgisRuntime

Question asked by kory.karr_NCS on Oct 16, 2020
Latest reply on Oct 16, 2020 by kory.karr_NCS

I'm upgrading from arcgisRuntime  .NET SDK 10.2.5 to 100.9.0. I am trying to find a suitable replacement for code like this:

string whereClause = "RouteID = 100" //Actually changes based on user interaction

ServiceFeatureTable serviceFeatureTable = featureLayer.FeatureTable as ServiceFeatureTable;
serviceFeatureTable.Where = whereClause;
serviceFeatureTable.RefreshFeatures(false);

The intent is we only show a handful (usually only 1) of the features in the feature layer. The where clause is actually built dynamically based on what the user is doing. The closest I can find is setting visibility on the features, but first I have to find all the other features and set their visibility as false:

 

 

//Hide All Features

QueryParameters queryParams = new QueryParameters();
queryParams.WhereClause = "1 = 1";
queryParams.MaxFeatures = Int32.MaxValue; //Doesn't seem to work
FeatureQueryResult allFeatures = await featureLayer.FeatureTable.QueryFeaturesAsync(queryParams);

long l = allFeatures.Count(); // Just for debugging

featureLayer.SetFeaturesVisible(allFeatures.ToList(), false);

 

//Show features matching query

string whereClause = "RouteID = 100"

queryParams = new QueryParameters();
queryParams.WhereClause = whereClause;
FeatureQueryResult filterResults = await featureLayer.FeatureTable.QueryFeaturesAsync(queryParams);

featureLayer.SetFeaturesVisible(filterResults.ToList(),true);


And this actually doesn't work either because it looks like the max number of features returned is 1000. It also seems very inefficient. Is there more straightforward way of hiding all the features except those that match a SQL type query?

Outcomes