There's a good reason why the graphics layers are on top of dynamic layers...however if you wish to move a dynamic layer above all graphics layers here's the scoop.The layers are in the map node like this: <div id="map_layers"> <div id="map_dynamic_layer_1"></div> //the layer id = dynamic_layer_1, the map_ is added by the api <div id="map_dynamic_layer_2"></div> <div id="map_dynamic_layer_3"></div> <svg id="map_gc"> <g id="graphics_layer_1"> //the g id = graphics_layer_1, api adds nothing GRAPHICS HERE </g> <g id="graphics_layer_2"></g> </svg> </div> You'll notice that all layers except graphic layers (this includes dynamic, tiles, wms, custom, etc) are divs, while graphic layers are contained in a single svg element. They are rendered top to bottom. When you reorder non-graphic layers with map.reorderLayer(layer, index) the api moves the layer to the index passed, always leaving the svg element on the bottom (rendered last and therefore on top). When passing a graphic layer through map.reorderLayer(layer, index) the layer is moved within the svg element. So the svg (all graphics) is a layer just like the others.Let's say we want "dynamic_layer_1" on top of the graphic layers: dojo.byId('map_layers').insertBefore( dojo.byId('map_gc'), dojo.byId('map_dynamic_layer_1') ); Done.Now that we know how it's done, let's discuss why you don't want to do it:1) May cause instability (IE is most vulnerable to this, and let's face it; it's a challenge enough getting the anything to work properly in IE to start with)2) Will cause erratic panning and zooming occasionally3) The user will no longer be able to interact with graphics or features (unless you move the layer down first, and the main reason why things are the way they are)4) You never know what's going to happen if you try to reorder layers using map.reorderLayer(layer, index) should you choose to do some reordering5) I think of several other issues and there is sure to be moreIf you are making a nice "story" map with no user interaction with graphics or features this will work ok, but...
<div id="map_layers"> <div id="map_dynamic_layer_1"></div> //the layer id = dynamic_layer_1, the map_ is added by the api <div id="map_dynamic_layer_2"></div> <div id="map_dynamic_layer_3"></div> <svg id="map_gc"> <g id="graphics_layer_1"> //the g id = graphics_layer_1, api adds nothing GRAPHICS HERE </g> <g id="graphics_layer_2"></g> </svg> </div>
dojo.byId('map_layers').insertBefore( dojo.byId('map_gc'), dojo.byId('map_dynamic_layer_1') );
Hi Phil, I'm not sure if it could be converted to a graphics layer. It might be possible but it needs to be a layer that accepts a bitmap, not points.Another option would be to just use the DIV with the canvas tag and position that over the map. In my implementation, I just have the DIV element containing the CANVAS element hidden and then the CANVAS bitmap is exported into the dynamic layer. However, the dynamic layer isn't absolutely necessary. The z-index of the CANVAS element could just be positioned over the map.I have the code here if you'd like to fork or contribute to it: https://github.com/driskull/ArcGIS-Heatmap-Layer--heatmap.js-
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.