Visualizing features in Javascript 4.x (laggy map)

08-20-2017 06:32 AM
New Contributor III


im working with the Javascript API 4.4 visualizing features on the map depending on a query.

The map is lagging while panning and zooming depending on the amount of features / size of the browser window and level of zoom. I am using Chrome as a browser. 

I tried 2 things to visualize the features:

  1. Load the feature layer and do a definitionExpression by property afterwards.  - This seemed to be a bad idea because when panning the map the query was executed again to fetch the features from the server.
  2. Create a query on the feature layer with a definitionExpression and than loop through all features on the feature service and add them to a graphicLayer.
rooms.queryFeatures(query1).then(function(result) {
    for (i = 0; i < result.features.length; i++) {
    roomsGraphic.visible = true;

The addGraphicsToLayer() handles the symbolization based on attributes of the feature. Following the feature is added to the GraphicsLayer


In both cases the map gets laggy while in 3.x i was able to create a smooth map with even more features from other services using "mode: esri.layers.FeatureLayer.MODE_SELECTION" (Feature Service 3.x)  on each feature layer.

Is there another possibility to visualize features with a better performance on the view or am i missing something else?



0 Kudos
1 Reply
New Contributor III

I solved the problem by using a MapImageLayer for the visualization, controlling the content by .definitionExpression. Clicking on the map i query the feature service for the geoemtry of the map point.


0 Kudos