I've been having a blast playing around with the new Web AppBuilder, and have taken a few cracks at putting together some custom Widgets that I'd like to share with the community. I hope these can assist in everyone's future Mappmaking endeavours!
September 28 2017 : LocalLayerWidget v2.5 released: This major release includes the following enhancements for the widget. Thanks to everyone who's donated!:
Release LocalLayerWidget 2.5 · cmndrbensisko/LocalLayer · GitHub
November 14, 2016: LocalLayerWidget v2.2 released: This major release includes the following enhancements for the widget:
Release LocalLayer v2.2 · cmndrbensisko/LocalLayer · GitHub
May 18, 2016: LocalLayerWidget v.2.0 released: This substantial change for Web App Builder v.2.0. removes the need to edit any core files in the Web App Builder, unlike previous versions. A slight change will still be necessary for the AttributeTable widget to work properly with LocalLayerWidget layers.
Mar 29, 2016: LocalLayerWidget v.1.3.1 released; Contains bugfixes to v.1.3. related to custom rendering for Feature Layers and toggling sublayer visibility in the LayerList widget.
Mar 22, 2016: LocalLayerWidget v.1.3 is now available! (Note the version naming change; Version 1.3 refers to its compatibility with v1.3 of the WAB - This is indeed the latest version of the widget as of March 22, 2016). Be sure to read the github page to see what tweaks need to be made to ensure that everything continues running smoothly in version 1.3 of the Web AppBuilder.
Feb 10, 2015: LocalLayerWidget v.1.5 is now available! This release contains full support for adding Tiled layers to your application directly from ArcGIS Server, in addition to the Basemap, Dynamic, and Feature layers available before. Feel free to grab the widget from our Release page located at https://github.com/cmndrbensisko/LocalLayer/releases.
Feb 2, 2015: LocalLayerWidget v.1.2 is now available! This release provides a great GUI developed by Robert Scheitlin to more easily add Feature, Dynamic, and Basemap layers to your ArcGIS Web AppBuilder Applications. Take it for a spin, and please keep us informed of any bugs or desired enhancements through our Github Issue Tracker located at https://github.com/cmndrbensisko/LocalLayerWidget/issues.
Jan 12, 2015: Note that LocalLayerWidget v.1.1 is now available, which provides Click-To-Identify support and the option to add Feature and Basemap layers in addition to Dynamic layers.
The LocalLayer Widget is intended to allow the direct addition of MapServices to an ArcGIS Web AppBuilder application, without needing to wrap the desired services in an ArcGIS Online/Portal Web Map.
https://github.com/cmndrbensisko/LocalLayerWidget
Basically, your basemap will still need to come from Portal/AGOL, but otherwise you just provide direct URLs to your own MapServices in the widget's configuration settings. The MapServices should load and display as usual in the map, and cooperate with the Legend, LayerList, and Attribute Table widgets. Click-To-Identify functionality won't work currently, though, because the current WAB implementation relies on Portal for all the popup info. As stated in the January 12th 2015 release, popups are fully customizable. Note that it's not an in-panel widget, so you'll need to follow a few extra steps in the project's Readme file.
Let's make Mapps accessible for everyone! With an eye on WCAG compliance, the Accessifizr Widget is designed to help make web applications keyboard navigable without having to modify core application code and UI.
https://github.com/cmndrbensisko/AccessifizrWidget
Information about how to configure this widget is available in the core Accessifizr.js library project available here, but the gist is that you create a JSON-based 'roadmap' detailing the keyboard navigation of your web application, and how it should change in response to users entering modal menus, hitting the escape button, etc. For applying descriptive alternate text to page elements, the widget leverages dojo's built-in internationalization support to specify multilingual alternate text strings. The end result is a web app that, hopefully, is a bit easier to use for people with mobility or visual challenges.
Robert, I'm impressed and looking forward to the version that contains the features shown in your PDF. Not being a github expert, is that version available yet? Looks like there hasn't been a merge for a while (and yes, I need to learn more about github forks and pulls). For now I'm adding my layers from the initial release (with mixed results, but just started), but the UI will make this all much easier.
Rebecca,
Adam is still reviewing the code. You would have to download from my branch on github to test.
rscheitlin/LocalLayerWidget at Add_UI_for_Local_Layers · GitHub
Thanks Robert. I'll see if I can can figure out the branch so I can play with it until the merge happens.
Robert,
I couldn't see the screens shown in your pdf when I added the widget to my WAB app. Either I did the install wrong, there was a conflict with Adam's v1.1 widget which was already installed, or your app is not ready to test. I tried removing Adam's widget, and that didn't help. I keep getting a copy widget error when I start WAB after installing the widget ("copy widget error. LocalLayerWidget null").
I will keep trying. Do you recommend that we use the current version of your widget to test, or should I wait?
Best regards,
Barnaby
EDIT: I got it. After the widget is copied to \client\stemapp\widgets directory, the widget directory must be renamed to "LocalLayer" so that it matches the data in the manifest.json. Then the widget loads into a new app perfectly, and I can see the screens from your pdf. This step should be added to your the widget install instructions.
EDIT2: Whoa. This is a HUGE step in the right direction. There are issues, but overall it's looking very good. Robert, could you make a new thread in which to discuss your new widget? This thread is getting very cluttered and confusing.
Barnaby,
Please continue to post here. I am not taking over this widget, just collaborating with Adam. What issue hve you found?
Hi Robert,
The functionality of your widget is substantially different than that of Adam's widget. Will your widget supersede Adam's? Will his github page go away and be replaced by yours? I hope so. Having two similar widgets is very confusing. And this thread is a real mess, difficult to read, as it contains about 5-6 mini threads, each with its own set of replies. Perhaps I should start a new discussion....
Issues with WAB app built using your widget:
1) The attribute widget does not work at all with the services added using your widget. No attributes are displayed from any layer. All my services are unsecured.
2) Sublayers of a dynamic service cannot be turned on and off individually. If one is turned on, they all come on. Only way to turn them off is by turning off entire dynamic layer. This is the same with Adam's widget. I have several hundred sublayers and sub-sub-layers in my service, so there is no way I can add each layer individually as a feature layer.
3) Install instructions need to be modified as I wrote in post above. default2DApp\config.json entry for widget should be thus:
{
"uri": "widgets/LocalLayer/Widget"
}
after renaming widget directory in \client\stemapp\widgets directory to "LocalLayer."
4) Feature layer "fieldinfo" pop-ups don't work properly. This code in config_Local Layer Widget.json
{ | |
"type": "Feature", | |
"url": "http://myserver/arcgis/rest/services/usminmap/SGMC_March2014_Geology/MapServer/1", | |
"name": "Geology (State Geologic Maps)", | |
"opacity": 0.55, | |
"visible": false, | |
"popup": { | |
"title": "State Geologic Map Compilation", | |
"fieldInfos": [ | |
{ | |
"fieldName": "State", | |
"label": "State", | |
"visible": true | |
}, | |
{ | |
"fieldName": "Generalized_Lithology", | |
"label": "Generalized lithology", | |
"visible": true | |
} | |
], | |
"showAttachments": false, | |
"tr": null | |
}, |
produces this pop-up
Note that there is no value for the State attribute displayed. I assume other attributes added to the pop-up will also not have values displayed. Note that this Feature layer is a tiled (cached) service.
5) It looks like Feature layers are always on top no matter what. I need to have dynamic layers overlying a feature layer, and this seems to be impossible.
I realize that some of these issues may be caused by Server 10.3 and/or WAB Dev itself, not the widget. I've only added a few services so far using your widget. As I add more, I'll post back if I find any issues with them.
Best regards,
Barnaby
Hey Barnaby, I thought I should weigh in here. Robert's widget is a very big upgrade from the one I initially posted, but "officially" (at least in terms of how we're managing the code currently), it's a beta version of the next version of the same widget.
I'm currently in the process of vetting it to make sure everything works well before upgrading the core code repository to include Robert's work, at which point both codebases will be unified. When we get to that step, which should hopefully be soon, we'll get to work on updating the documentation to reflect the new capabilities of the enhanced application.
You're running into some interesting edge cases with your environment, and as you keep documenting them, we can try to tackle them in future enhancements. If you have a Github account, you should be able to add Issues to the repository's bug tracker at https://github.com/cmndrbensisko/LocalLayerWidget/issues . This thread is getting a big cramped, so we may try to encourage bugs/issue reporting and enhancement requests to Github to keep everything centralized. I'll be sure to edit the original post to reflect this.
Regarding the issues you raised in your post:
From what I've tested using the new version of the widget, I am able to turn sublayers on and off in the LayerList widget for Dynamic MapServices, even with MapServices with all layers turned off by default. Would you be able to create a bug report for this in the repository, potentially with the /MapServer?f=json rundown of your service's setup and capabilities?
Regarding your State issue, I am able to duplicate something similar on my end with Aliased fields. We can try to fix this before the official rollout of Robert's upgrade.
The Feature Layer issue seems to be driven by ArcGIS Online; We can start to investigate how we might be able to deliver finer-grained control of layer order in later versions.
Barnaby,
I am in agreement with Adam. I personally did not think that a widget like this was possible so I did not venture down this road and then I saw when Adam released His initial version and I knew I wanted to lend my experience developing UIs for widgets to His project. This is what GitHub is all about.
I believe I have the fix for both your #4 issue and your #1 when talking about FeatureLayers. I can still not get your Regional_Studies_pub mapservice to work with that attribute widget but I almost positive that is an esri problem and not the Local Layer widget. In the widget.js in the FEATURE type if block just add
lOptions.outFields = ['*'];
before the layer is added to the map.
Awesome, Robert! I'll try that out now. I assume that I should still add this item to widget version 1.2?
Cheers,
Barnaby
Edit: Robert, the lOptions.outFields = ['*']; code is already in the widget.js for version 1.2.
Edit 2+: Yep, in widget version 1.2, now all checked fields are displayed for pop-ups in a Feature service!!!!!
So issues 3 and 4 in my post are now solved. Great work! I haven't yet added the "visible": false" line to \client\builder\predefined-apps\default2DApp\config.json, and the widget appears to work perfectly in WAB DEV. Are you sure I need that? What is it for? I do want the widget to be visible in WAB when editing apps...
Sublayers of a dynamic layer can now be turned on and off individually as in Flex for Regional Studies service, but not for other, simpler dynamic layers (Landsat 7, Landsat 8, and ASTER). Pop-ups do not work for any of these dynamic layers, as they contain mainly thematic rasters (same as Flex). The Legends display for sublayers of the Regional Studies dynamic layer, but not for the Landsat and ASTER dynamic layers. This behavior is the opposite of that of widget v1.1.
Can you get the Legend to display for this service if it is added as a dynamic layer? I cannot.
http://cmerwebmap.cr.usgs.gov/arcgis/rest/services/usminmap/Landsat7_West/MapServer
The legend displayed normally in widget v1.1. ??? The weird thing is, the Legend is displayed normally for individual sublayers of the Regional Studies dynamic layer
http://cmerwebmap.cr.usgs.gov/arcgis/rest/services/usminmap/Regional_Studies_pub/MapServer
I am completely confused by that...
Edit 3: Note that a tiled service (a geodatabase of nationwide vectors in this case) added as a Feature layer using the widget draws very slowly. The same tiled service draws instantly when it is part of an AGOL Web Map added to a WAB Dev app.
Ok, I think I have discovered what is preventing sublayers of dynamic layers being turned on and off individually, AND what is preventing legends of dynamic layers from displaying.
Case 1: A service is published in which the top layer is On in ArcMap:
Note that the top-most "Landsat 7 ETM+..." layer is On. When this service is added as a dynamic layer using widget 1.2, its legend will NOT display in the WAB app, and its sublayers CANNOT be turned on and off individually. All sublayers are always on, and can only be turned off when the entire layer is turned off in WAB layer menu. Since multiple sublayers are on, WAB doesn't know which sublayer to display a legend for:
Case 2: A service is published in which the top layer is Off in ArcMap:
Note that the top-most "Landsat 7 ETM+..." layer is Off. When this service is added as a dynamic layer using widget 1.2, its legend WILL display in the WAB app, and its sublayers CAN be turned on and off individually:
Is there a way to fix this so that sublayers of dynamic layers can be toggled on and off normally whether the top-most layer in the service is on or off when published?
Best regards,
Barnaby