Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
This does get the layer to show in the gallery but it's a little more code than I was hoping for. With non-vector basemaps I can add them to the esriBasemaps object which allows me to set them as the default basemap for a new map object and have them appear automatically in the BasemapGallery. I'm starting to think that's not possible in the 3.x API
@ziemek In the example below, ImportantLayer is a placeholder for the id of the layer that should be on top. This id can be defined multiple ways depending on how you are creating your map/adding your layers. I suggest you ask a separate question about how to retrieve that if you need help finding it. That will allow you to provide details about how your map and layers are created.
expression is deprecated in 4.5 and viewExpression: '$view.scale' only works for MapViews. However, I did find this link with an example of changing the renderer every time the map zooms: community.esri.com/message/… That does what I want.