I am displaying polygon, line and point feature layers on a button click event and adding layers in order based on their geometry type, e.g.: polygon -> line -> point.

In certain cases layers are rendered fine as we add them, but in some cases as the amount of data (and response time) increases in one of the layers, the polygon layer is rendered on top of the point and line layers and these layers get hidden.

We have already used reordering code but its not much of use. Are there any methods to control the rendering of layers or move layers one above the other?

I am using ArcGIS Server 10.1, feature service and the ArcGIS JavaScript API 3.1.

  • 1
    Any chance you can post a JSFiddle that replicates the issu or at least some code that is stripped down to small enough where its still happening?
    – jakc
    Commented Feb 7, 2013 at 9:29
  • Actually I am working on production website and it is for organization so I cannot provide the code.Sorry.
    – Gunner
    Commented Feb 7, 2013 at 9:34
  • 2
    Even if you strip the code down to a snippet that replicates the issue? If its logic thats not working anyhow, then whats the harm of sharing?
    – jakc
    Commented Feb 7, 2013 at 9:36

2 Answers 2


The Layer class has methods suspend() and resume(), so you could catch the onUpdateStart event to suspend all but the lowest layer from drawing. Then, in the onUpdateEnd event of the lowest layer you could call resume() for the next layer up, and so on.

Or if you're using FeatureLayers you could trigger each layer's refresh() method in order. Either way would probably be subject to random bugs.

Have you considered looking at the map services to see if any of them are slowing things down? Limiting the amount of data or implementing some kind of clustering might be better than trying to hack the layer refresh process.

  • I will tryout and let you know...
    – Gunner
    Commented Feb 8, 2013 at 8:12

I also struggled with a similar problem, and in case someone might come across this problem, here is a simple solution. You just have to play with map.add component of your script as in the snippet below

// Adding all the maps to the scene

map.add(PointLayer, 3);

map.add(PointLayer2, 1);

map.add(LineLayer, 2);

map.add(PolygonLayer, 0);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.