Increase shapefile featureLayer performance

279
5
Jump to solution
10-11-2017 02:36 AM
EdL
by
New Contributor II

I am looking at the v10.2.7 runtime guide to load a featurelayer from a large shapefile.

My shapefile is huge with 200k point entries. I find the loading and the map panning/zooming to be slow (can be considered unusable).

How can I improve the feature layer's performance?

How can a shapefile spatial index be utilized (is it loaded together when calling "ShapefileTable.OpenAsync(path);")?

Reply
0 Kudos
1 Solution

Accepted Solutions
MortenNielsen
Esri Frequent Contributor

The shx file is the "shapefile index" not the "shapefile _spatial_ index". The shx file is required for the file to even work. A spatial index usually have the extension .sbn. You should be able to create one using ArcMap/ArcGIS Pro. That should get you dramatically improved performance when looking at a subset of features.

Wrt to filtering by ID, the same thing applies: If you want to filter by attribute, it's recommended to create an index for the fields you're going to filter by.

Without indexes, all filters has to be brute-forced, making things slower.

View solution in original post

5 Replies
XanderBakker
Esri Esteemed Contributor

I assume that the spatial index is automatically used when the data is loaded (not sure though), because it doesn't make sense that you explicitly have to switch it on when it is available. Maybe the way you draw the features can be of influence; are there any definition queries set or are you using an attribute to define the symbology. Inn that case you will also get a lot of benefit from setting a attribute index on those attributes: Add Attribute Index—Help | ArcGIS Desktop 

Normally it will not make a lot of sense to visualize 200.000 points in a map (if it is densities you are after you have other ways to visualize that). Define scale dependency on the layer to make it start drawing at a certain scale.

Reply
0 Kudos
MortenNielsen
Esri Frequent Contributor

Do you see performance dramatically improve when you zoom in to an area with fewer points? (that should indicate that the spatial index is active).

Reply
0 Kudos
EdL
by
New Contributor II

On zooming in, there is no change in performance. The map loads equally as slow as if trying to always render all 200k map points.

I have checked that the shapefile does have a spatial index (.shx) file (just not sure if really loaded). I have set the min & max scale, simple symbology and intentionally set a definition expression to show only 1 point but no effect on performance.

FeatureLayer flayer = new FeatureLayer(shapefile)
{
                    ID = LayerID,
                    DisplayName = path,
                    Opacity = 0.6,
                    Renderer = new SimpleRenderer { Symbol = new SimpleMarkerSymbol { Color = Colors.CornflowerBlue, Size = 12, Outline = new SimpleLineSymbol { Color = Colors.Black, Width = 1 } } },
                    MaxScale = 400,
                    MinScale = 100000000,
                    DefinitionExpression = "ID = 17020001003930",
};

Reply
0 Kudos
XanderBakker
Esri Esteemed Contributor

Does the field ID have an attribute index?

Reply
0 Kudos
MortenNielsen
Esri Frequent Contributor

The shx file is the "shapefile index" not the "shapefile _spatial_ index". The shx file is required for the file to even work. A spatial index usually have the extension .sbn. You should be able to create one using ArcMap/ArcGIS Pro. That should get you dramatically improved performance when looking at a subset of features.

Wrt to filtering by ID, the same thing applies: If you want to filter by attribute, it's recommended to create an index for the fields you're going to filter by.

Without indexes, all filters has to be brute-forced, making things slower.

View solution in original post