Closed torrin47 closed 7 years ago
Note from the meeting was that changing layer order is a "want" item in Active layers. Seems that some web services and layers are shown above tiled services. need to verify the draw order and see if we can override this. May be that we cannot change the draw order but may need to denote which services are under others. It seems that all tiled layers draw below any poly or linear layers - what is default/defined in JavaScript API?
I did some practice on this issue--- trying to reorder layers so that polyline Boundary layers stay on top when user add polygon layers from SimpleSearchFilter. But I found that even after I make the reordering, the tiled services would always be on top when user zoomed in. Currently, I have not found a way to move the boundary layers on top of those tiled services.
Not sure I have found the cause: according to discussions on https://geonet.esri.com/thread/89211, FeatureLayer is always on top---- cannot be re-ordered. Our Boundary layers are ArcGISDynamicMapServiceLayer while our layer searchable from SimpleSearchFilter widget are FeatureLayers. That is why the national layers added from SimpleSearchFilter widget always cover boundary layers.
makes sense to me - that's always the way it was in Flex....
On Fri, Mar 17, 2017 at 2:07 PM, Baohong notifications@github.com wrote:
Not sure I have found the cause: according to discussions on https://geonet.esri.com/thread/89211, FeatureLayer is always on top---- cannot be re-ordered. Our Boundary layers are ArcGISDynamicMapServiceLayer while our layer searchable from SimpleSearchFilter widget are FeatureLayers. That is why the national layers added from SimpleSearchFilter widget always cover boundary layers.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Innovate-Inc/EnviroAtlas/issues/356#issuecomment-287471296, or mute the thread https://github.com/notifications/unsubscribe-auth/AGH_1oLWPemsdNSgextHqLjJHhhtRgQqks5rmvX2gaJpZM4MRrgI .
-- Barbara Rosenbaum Innovate!, Inc. Office: (541) 929-6622 Message: (703) 922.9090 x 739 brosenbaum@innovateteam.com
Innovate!, Inc. is a Virginia-based 8(a), Hispanic- and woman-owned business delivering Geospatial, Information Technology, Security, Business Consulting, Project Management and Executive Coaching solutions to our government and private sector clients. Check us out at www.innovateteam.com.
Ok... So I know at least one exception to that rule - within the deployed LEB application, try zooming in to where features are displaying (any layer), setting the transparency to 0%/Opaque, and then switch the basemap to Terrain with Labels, Imagery with Labels, Light Grey Canvas, or Oceans. In all of them, the tile cached labels are rendered above the client-side features. Now I don't know what kind of black voodoo magic Esri uses to accomplish this, but it does suggest that there's a way despite what RScheitlin and the JavaScript API documentation say.
But say we accept that it's not possible for feature layers. (Get ready for some crazy talk.) Do we have any requirements that necessitate the use of feature layers beyond being able to add and remove individual layers from the map? I'm having a hard time thinking of any - we're not doing editing, we're not doing any fancy client-side mouseover effects. And our feature layers are having a hard time getting adequate performance at the scales the EPA team wants to see, and they can't be rendered in the order EPA wants to see. I know it's really late in the game, but what if instead of adding the individual layers as FeatureLayers, we add each separate layer as ArcGISDynamicMapServiceLayer with only one layer turned on? We'd still be able to do the dynamic rendering, we'd be able to re-order as needed, and we'd get much better performance. If they turn on multiple layers, that would mean multiple requests for separate images, even for layers that are part of the same map service, which isn't ideal, but how often are they really turning on multiple layers from the same map service? It's all choropleth data, there's really not much to see when multiple layers are turned on, so I think this would be pretty rare. Now I have no illusions about this being an easy switch on the code side, and I'm not sure about the implications for the popups (which we're already meddling with to enable for the tile cache) or the legend or attribute tables. We'd also need to be sure that within the Layer List widget these individually added layers still act like individual layers and don't show the full list of other layers in the same map service. How crazy is this idea? What other problems might occur? How many months of recoding are we talking? Just wanting to challenge brain cells on a Friday!
In order to test the idea of adding separate layer as ArcGISDynamicMapServiceLayer with only one layer turned on. I just tried to add Boundary layer (States, County, and Census Block Groups) as ArcGISDynamicMapServiceLayer with only one layer (States) turned on so that I can know how WAB will perform. I use following code to specify that only the first layer "States" will be added. imageParameters.layerIds = [0]; lLayer = new ArcGISDynamicMapServiceLayer(layer.url,{"imageParameters": imageParameters}); With such code, I can add just one layer -- States, but strangely, all the other two layers "Counties" and "Census Block Groups" are also shown in LayerList Widget and could also be added when checked on in LayerList. Such method could be tested in https://leb.epa.gov/Projects/enviroatlas/CurrentDevelopment/EnviroAtlas_WAB/
So I got an impression that if we add separate layer as ArcGISDynamicMapServiceLayer with only one layer turned on, there should be at least major changes to LayerList widget as well as legend. And I do not know whether we can accomplish this. Those are the difficulties I can see now. Maybe later we might see other problems such change symbology or attribute table.
With all of those difficulties, I am wondering if we could add Boundary layers as Feature Layer. That is, treat boundary layers the same way as all the other layers in current config.json. It is true that we can not re-order Feature Layer, but we might be able to give a trick---- because the newly added Feature Layer will be displayed on top, we can remove the layer which user want to move to top and add back again--- in such way, we can make the user believe that the layer is moved to top. I think this is doable and will need less code modification. The only difficulty I can see is the "grouping for boundary layers". If we add each boundary layer as Feature Layer, we cannot group them naturally, but maybe we can use the current group style in SimpleSearchFilter.
Torrin, Barb and David, let me know what you think, is there any other problems you can think of if we add boundary layers as Feature Layer?
Baohong accurately pointed out the issue with grouping - we were trying hard to push them to treat boundary layers as complete services, so we'd backtrack on that. And we lose the performance we get from server-side rendering. I don't know whether there's some upper limit of how many features from multiple services we can push into client side rendering before we start bogging down browsers, but my guess is that although this is a step in that direction, it's not a major risk. To address the grouping issue, could we put these data into ArcGIS Online and serve them as hosted feature services, so that we could still add them as a complete service? Or maybe there are already hosted feature services out there we could take advantage of? It's frustrating how in this case ArcGIS Server is completely capable of doing what we need, and it's the front end WAB Layer List widget that would need a complete overhaul to accomplish what we need. And I am wary of doing so if the JavaScript API 4.0 is somewhere on the horizon with a corresponding overhaul to the WAB widgets. Sigh.
On Mon, Mar 20, 2017 at 1:55 PM, Baohong notifications@github.com wrote:
In order to test the idea of adding separate layer as ArcGISDynamicMapServiceLayer with only one layer turned on. I just tried to add Boundary layer (States, County, and Census Block Groups) as ArcGISDynamicMapServiceLayer with only one layer (States) turned on so that I can know how WAB will perform. I use following code to specify that only the first layer "States" will be added. imageParameters.layerIds = [0]; lLayer = new ArcGISDynamicMapServiceLayer(layer.url,{"imageParameters": imageParameters}); With such code, I can add just one layer -- States, but strangely, all the other two layers "Counties" and "Census Block Groups" are also shown in LayerList Widget and could also be added when checked on in LayerList. Such method could be tested in https://leb.epa.gov/Projects/enviroatlas/ CurrentDevelopment/EnviroAtlas_WAB/
So I got an impression that if we add separate layer as ArcGISDynamicMapServiceLayer with only one layer turned on, there should be at least major changes to LayerList widget as well as legend. And I do not know whether we can accomplish this. Those are the difficulties I can see now. Maybe later we might see other problems such change symbology or attribute table.
With all of those difficulties, I am wondering if we could add Boundary layers as Feature Layer. That is, treat boundary layers the same way as all the other layers in current config.json. It is true that we can not re-order Feature Layer, but we might be able to give a trick---- because the newly added Feature Layer will be displayed on top, we can remove the layer which user want to move to top and add back again--- in such way, we can make the user believe that the layer is moved to top. I think this is doable and will need less code modification. The only difficulty I can see is the "grouping for boundary layers". If we add each boundary layer as Feature Layer, we cannot group them naturally, but maybe we can use the current group style in SimpleSearchFilter.
Torrin, Barb and David, let me know what you think, is there any other problems you can think of if we add boundary layers as Feature Layer?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Innovate-Inc/EnviroAtlas/issues/356#issuecomment-287894939, or mute the thread https://github.com/notifications/unsubscribe-auth/ACB0vLAnNO3jv7xKoGPnarKW4TphSfI2ks5rnue9gaJpZM4MRrgI .
-- Torrin Hultgren Senior Manager, Geospatial Solutions Innovate!, Inc. O: (703) 922-9090 x737
Innovate!, Inc. is a Virginia-based 8(a), Hispanic- and woman-owned business delivering Geospatial, Information Technology, Security, Business Consulting, Project Management and Executive Coaching solutions to our government and private sector clients. Check us out at www.innovateteam.com.
Perhaps I did not fully understand the requirement of "Grouping". Torrin, could you explain more what is grouping? Are current selectable layers in SimpleSearchFilter grouped already?
So in preparation to ask Esri what their "secret sauce" was to make the tiled labels draw on top of the graphics layer, I checked out the css for that map layer. Turns out the label layer is identical to the backdrop layer in every respect except one: it has an html attribute set to data-reference="true"
<div data-reference="true" id="map_layer4" style="position: absolute; width: 1276px; height: 848px; overflow: visible; transform: translate(0px, 0px); display: block;">label tiles </div>
and that ends up assigning the whole div a css value of z-index:1
.map .esriMapContainer .esriMapLayers > div[data-reference="true"] {
z-index: 1;
}
Now, Esri's JavaScript API doesn't explicitly give us access to this div, I'm not sure whether it even gives us access to the div ID, but it sure seems like we ought to be able to hack it, and whenever we add a boundary layer, either give it the data-reference="true" attribute or the css style element of z-index:1 (or some other value we track). Doesn't solve how we deal with it in the Layer List widget, but at least it wouldn't be rough to get the drawing order right.
Thanks, I will use the clue to explore the possibility of moving ArcGISDynamicMapServiceLayer to top.
Boundary layers added as ArcGISDynamicMapServiceLayer are now forced on top of map. This is accomplished by setting zIndex to be 1 for Boundary layers' div. So this method is similar to Torrin's clue.
It is good that popup info window works for the added feature layers even though boundary layer are on top of map.
But as stated in ESRI's document---ArcGISDynamicMapService layers are always under feature layer by default, our boundary layers are always at the very bottom in LayerList widget and Legend widget. We might need to adjust the layer order later. Since to adjust the layer order in Layerlist widget and Legend widget is not a minor task. I will not do it unless there is a clear requirement or a requested priority.
According to discussions in https://geonet.esri.com/thread/89211, map might crash if user wants to re-order layers when ArcGISDynamicMapService Layers are forced on top. So next week, I will work on "Move to Top" function for added feature layers (issue #333). By then, we will know how stable it is for our map. Let me know if issue #333 is not a priority.
"Move to Top" function is added to each layer and map with boundary layers forced on top is not crashed by "re-ordering" of layers.
This probably also means they need to remain at the top of the table of contents, unless we truly want to hide them from the table of contents. How feasible is it to simply hide them from the layer list widget? (They'd still need to appear in the legend widget).