Feature Layer Graphics Limitation via Source

2772
12
01-25-2018 10:01 AM
DaltonMangrum1
New Contributor II

Hi,

I'm trying to load a simple Map & MapView with a single Feature Layer and am seeing some serious performance degradation when I attempt to load the layer with thousands of features. 

I'm using the ArcGIS JS API v4.6.

I'm not loading the Feature Layer graphics via an ArcGIS Feature Service URL, but rather loading it client side via the "source" property.

If I limit the number of features to 1000 the map becomes responsive. 

If I load the Feature Layer with an ArcGIS Feature Service URL the map is fully responsive even when rendering 30,000+ features.

The data set I'm using to load the Feature Layer locally via the "source" property is a small subset of the data available on the Feature Service, and the graphic I'm using is a very small SVG (approximately 600 bytes).

The reason for my question is to see if there is any known limitation to loading a Feature Layer's graphics client side via the source property, or if there is a way to emulate the optimization/rendering logic utilized when a Feature Layer is loaded from an ArcGIS Feature Service URL.

I've confirmed that my browser supports WebGL and have even added the "esri-featurelayer-webgl" setting to the dojoConfig in the <head> of my index.html file in order to enable WebGL for Feature Layers as seen here:

ArcGIS API for JavaScript Sandbox 

<script>
var dojoConfig = {
has: {
// Enable webgl for feature layer in MapView
"esri-featurelayer-webgl": 1
}
};
</script>

Unfortunately i'm not seeing any effect of enabling this setting.  Hopefully someone can shed some light on what I'm doing wrong.

Thanks,

Dalton

12 Replies
yangwen
New Contributor III

It seems like the FeatureLayer, when created with an array of client-side graphics via the source property is rendered as SVG.  SVG is inherently nonperformant as the number of on screen element increases.  Can we force the library to render with canvas?

I find it a bit ironic that in the 4.6 API documentation, Esri even makes the effort to have this line in the section titled Add an array of client-slide graphics

"There is no limit to the number of graphics that may be added to a FeatureLayer via source."

weili7
by
New Contributor II

Hello,

  I has same scenario. I trying load about 2 thounds polygon on feature layer via source property and i need frequently switch some polygons to another polygons. I found if i use same feature layer then call applyEdits to delete/add polygon, sometimes some polygon is keep on screen(should be disappeare). Then i try delete whole feature layer then recreate new, it look like cause memory leak and many console warning "WARNING: Too many active WebGL contexts. Oldest context will be lost."

0 Kudos
charlymietton
New Contributor

I'm surely late but for the sake of this thread is a solution to your problem : https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-large-collection/
I've not tried it yet (I have the same issue, adding 30k+ client side features to a FeatureLayer), but the official documentation point that we should add them chunk by chunk

0 Kudos