Feature Layer order in map

3231
4
Jump to solution
03-11-2016 11:39 AM
TimWitt2
MVP Alum

Hey everybody,

When you look at the following app CFX Map you can see that my point featurelayer is below the line feature layer. How can I get the points on top of the lines?

Also I noticed when I refresh the app sometimes the layers get re-arranged my legend, I guess depending on how the layers load. How could I have a set order?

Thanks.

Tim

0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Tim,

To get the points to draw on top of the other services you will need to update the addLayers method and specify the point service last.  Ex:

map.addLayers([cfx,cfxprop,turn, tollLayer]);

View solution in original post

4 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Tim,

To get the points to draw on top of the other services you will need to update the addLayers method and specify the point service last.  Ex:

map.addLayers([cfx,cfxprop,turn, tollLayer]);

TimWitt2
MVP Alum

Thanks Jake, that fixed this issue.

Do you know if the only way to fix the random re-arranging layers in the Legend dijit can only be fixed by sorting the object before it gets fed to the dijit?

0 Kudos
JakeSkinner
Esri Esteemed Contributor

I think you may have to sort the object before it's sent to the legendDijit constructor.  For example, if you want to order the legend by title in ascending order you could use the following:

layerInfo = layerInfo.sort(function(a, b){
          return a.title < b.title;
        });
TimWitt2
MVP Alum

Ok, that's what I thought.

Thanks Jake for your help!

0 Kudos