Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
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? –  Simon Feb 7 '13 at 9:29
    
Actually I am working on production website and it is for organization so I cannot provide the code.Sorry. –  Gunner Feb 7 '13 at 9:34
1  
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? –  Simon Feb 7 '13 at 9:36

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
I will tryout and let you know... –  Gunner Feb 8 '13 at 8:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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