Feature has generalized geometry after loadAsync .net arcGisRuntime 100.9.0

3696
2
10-25-2020 10:18 AM
KoryKarr
New Contributor

I am experiencing an issue where features are not fully loading. Their geometry remains generalized. 

Here is the code I am using (.net arcGISRuntime 100.9.0)

Uri serviceUri = new Uri(layerInfo.LayerUrl);
CenterlineFeatureLayer = new FeatureLayer(serviceUri);
await CenterlineFeatureLayer.LoadAsync();

Map.OperationalLayers.Add(CenterlineFeatureLayer);

This happens before the map is visible (it's in another tab of the application).  When we view the map it looks like the attached snapshot, map-after-loadAsync.

Oddly, if I don't load the layer by commenting out line 3, the geometry seems to be fully loaded. This is a bit hard to demonstrate, but in snapshot Map-no-load, you can see one non-generalized feature. There are other features visible because we apply normally apply definition expression. But the unloaded features don't have the needed columns so the code applies a blank definition expression and nothing is filtered out. 

A couple of more details: There should be tens of thousands of features in the service feature table. I seem to remember it only loading 1000 records at a time, so maybe its not loading the one I want to see? The features are all over north america, and we set the extent on the mapView after the feature is loaded -- the users selects a record on a different tab, then the map goes to corresponding feature in another tab (using MapView.SetViewpointGeometryAsync). 

Is there a way to force the features in the mapView's current viewport to load? Do I have to do anything after setting the definition expression? In the examples I've seen, the code just sets the definition expression. 

0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

After querying or identifying a feature are you explicitly loading that feature, or are you just loading the table? ie

await (feature as ILoadable).LoadAsync();

Could you share some snippets showing how you retrieve a feature from the map?

0 Kudos
KoryKarr
New Contributor

The user selects a record on a grid. This record has a foreign key to a spatial table.

We apply the definition expression like this:

string whereClause = GetWhereClauseForLayer(layer); // Complicated logic based on columns the layer's table.
layer.DefinitionExpression = whereClause;

After that, we center the mapview on the geometry for the corresponding feature(s) We query the table like this:

QueryParameters query = new QueryParameters
{
  WhereClause = BuildWhereClause(columnName, ids) //similar, complicated logic
};
IEnumerable<Feature> features = await featureLayer.FeatureTable.QueryFeaturesAsync(query);

//I just added this foreach block, but it doesn't seem to change anything.

foreach (ILoadable feature in features.Cast<ILoadable>()) 
{
  await feature.LoadAsync(); 
}

Then we get the list of geometries and find the union and set the viewpoint:

IList<Geometry> geometries = features.Where(f => f.Geometry != null).Select(s => s.Geometry).ToList();

Geometry unionedGeometry = GeometryEngine.Union(geometries);
await mapView.SetViewpointGeometryAsync(unionedGeometry, 10);

One thing that I just noticed now at home where the network is much slower. The map starts showing the feature's actual geometry, without a basemap (grey grid). Then the basemap slowly loads, and when it's done, the feature changes to the generalized shape.

0 Kudos