Select to view content in your preferred language

Controlling the layers order with certain basemap types between esri 3.x and 4.x

1127
2
Jump to solution
10-26-2023 03:56 PM
JacksonQiu
Emerging Contributor

Our implementation allows the user to configure their basemaps, and the default is "gray". We also render graphic layers with a collection of graphics and graphic layers with a collection of text symbols on top of these basemaps.

On esri 3.x, our graphics and text symbols would always render on top of all basemaps, including type "gray" but also other combinations of tileLayers and vectorTileLayers we might have chosen.

On esri 4.x, it seems like the gray basemap's reference layer is always last in map.allLayers. I am unable to change this with map.reorder, as that is only able to change the map.layers collection. Is there any way to achieve what we had in 3.x, where the graphics and textSymbols would show up on top of the reference layer?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
AnneFitz
Esri Regular Contributor

In 4.x you could do this by removing the Basemap's referenceLayers and adding them to the collection of baseLayers instead. Here's an example: https://codepen.io/annefitz/pen/JjxYLvO?editors=1000

 

View solution in original post

0 Kudos
2 Replies
AnneFitz
Esri Regular Contributor

In 4.x you could do this by removing the Basemap's referenceLayers and adding them to the collection of baseLayers instead. Here's an example: https://codepen.io/annefitz/pen/JjxYLvO?editors=1000

 

0 Kudos
JacksonQiu
Emerging Contributor

That worked like a charm, thank you!