Even if you don't go the zIndex route, you can add whatever properties/values to the layers and make more functions that reference them. For example, when I first added historic map layers to this installation: crhim.canerivernha.org/map, I found that they would get mixed in with the overlays. However, I wanted to retain this order: basemap < historic map < overlay < resources. I gave the overlay layers a "nobutclose" value in the isArchesResource property, and then just added this <https://github.com/mradamcox/crip/blob/a835a942c6e2d497b48e8e99401897c97d89228d/crip/media/js/map.js#L32>to the elevate arches layer function.
Just to say there are lots of ways you can manipulate the layer order... On Tue, May 10, 2016 at 11:19 AM, Rob Gaston <[email protected]> wrote: > Travis, > > Adam is correct here - the behavior you’ve described is by design. Layers > are indexed in the order that they are added to the map. > > You could probably add a `zIndex` property to your layer objects and use > that to set the z-index in the function that Adam linked to, but beware > that you’ll probably need to upgrade OpenLayers to >3.9.0 as that is when > they started supporting z-indexing, and this upgrade may have unforeseen > side effects on your application. That being said, should you want to > undertake this, the following OpenLayers example will probably be helpful: > http://openlayers.org/en/v3.9.0/examples/layer-z-index.html?q=index > > - Rob > > > On May 10, 2016, at 9:53 AM, Adam Cox <[email protected]> wrote: > > Hi Travis, I don't think z-index has anything to do with the layer stack > of the map, it's all based on the order of the layers as they are added to > a list. I think the problem may be that only onMap layers are added to the > map layers (whether visible or not) when you navigate to the Map View, but > as you add more they are place on top of that stack. I think you'll need > some javascript skills to dive into this function > <https://github.com/archesproject/arches/blob/stable/3.x/arches/app/media/js/map.js#L39>, > which is in the media/js/map.js file. I would suggest that you copy that > file from its original location (ENV/.../arches/app/media/js/map.js) and > paste it into your own app. Then begin by adding some print statements. > > Sorry I can't give a more full solution right now, but hopefully this can > point you in the right direction. > > Adam > > On Monday, May 9, 2016 at 5:52:32 PM UTC-6, Travis Scott wrote: >> >> Hi Everyone, >> >> We are adding external layers to our layers.js and having trouble getting >> them to overlay in the order we would like. The layers are a mix of >> "onMap: true" and "onMap: false" and we are finding that the "true" layers >> overlay in the order listed in layers.js however the "false" ones do not >> and instead overlay in the order in which they are "added" in the "manage >> map layers" popup. Further, the "false" layers always overlay the "true" >> ones once added to the map. >> >> Ideally we would like to solve both of these problems and have the layers >> overlay in the order listed in layers.js but at the very least have the >> "false" ones come in under or below the "true" when added. We have been >> trying out the zIndex but to no avail. Does anyone know if this is >> controlled by zIndex or something else or have any suggestions on solving? >> >> Thank you all in advance! >> > > -- > -- To post, send email to [email protected]. To unsubscribe, > send email to [email protected]. For more > information, visit https://groups.google.com/d/forum/archesproject?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Arches Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > > > -- -- To post, send email to [email protected]. To unsubscribe, send email to [email protected]. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en --- You received this message because you are subscribed to the Google Groups "Arches Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
