SaveSession Widget

38209
113
02-06-2016 09:57 AM
Labels (1)

SaveSession Widget

The SaveSession Widget for ArcGIS Web AppBuilder enables users to save the current map settings into a session and restore them again later. A saved session includes the extent, visible layers and annotations of the current map. Sessions may be saved and loaded from files so they can be shared with others.

Using the Widget

The SaveSession Widget is an in-panel widget that will be displayed in the toolbar of your WebApp Builder application. Click the  icon icon display the SaveSession panel.

Configure Icon

Saving a Session

Once you have the map just the way you want it - zoomed to the area and layers turned on, enter a name for the session and click the Save button. The session will be added to the Saved Sessions list.

Configure Icon

Restoring a Session

To return the map to the same state as when you saved the session, you can double-click the title of the session to load the map.

Managing Sessions in the List

Hover over the Actions column for a session entry to reveal the actions that can be performed on the entry.

Load Map = will load the restore the selected session to the current map

Load Action

Download Map = will save the session entry to a file that may be shared.

Download Map Action

Edit = allows the user to change the session name

Configure Icon

*Move Up - Down * = lets you arrange the entries in the session list in the desired order

Delete = click the Delete button to remove the entry from the list

Configure Icon

Sharing Sessions

Saved Sessions may be shared with other users or another browser on the same PC by saving the session to a file and then loading the session from the file into the session list.

To save a single session to a file, click the Download Map action for the entry. To save all sessions in the list to a file, click the Save to file link.

Configure Icon

To load the sessions from a file, click the Load from file link to display the Load sessions from file dialog

Configure Icon

Click the Choose File button and select the file to load. The selected file must be a saved session file. All sessions from the file will be loaded. If a loaded session has the same name as an existing session, a number will be appended to the session to make the name unique.

Configure Icon

Widget Setup

Source code and installation instructions may be found at GitHub - softwhere/SaveSession-Widget

v2.7  - released on 4/3/2018

Download

Thanks to the City of Garland, Texas for sponsoring the initial development of the SaveSession Widget and releasing it to the community.

Labels (1)
Tags (1)
Comments
Anonymous User

Simo that works perfectly! Thank you. I recommend folks use Simo's updated version.

Anonymous User

Lefteris that version does not work, layers do not load, and the layers come in with weird names etc. Simo's works, including sublayers, and retains results in cache. 

Anonymous User

simo xu‌ that works perfect! Thanks - you're awesome!

Question ... it does not restore the basemap if that was changed in the Basemap widget. Would that be possible in a future version? Just a thought.

Interestingly I thought I would check with the built in App State and that doesn't do it either. I will suggest that to Esri in a new idea.

Hello Kevin. I just tested the widget and it works as intended (I attached a small clip). As I mentioned before it works for me and I don't use webmaps or the portal. It can  also save any imported shp and kml files, the current basemaps, custom drawings....

Anonymous User

Lefteris I use webmaps simply via AGOL. So it added a layer 'basemaplayers' layer I have no idea where it came from. And all the layers were checked on but did not have sublayers. Thank you for providing your widget though! It will help people that programmatically add layers. I will post an example with your widget in my app using a webmap so I can show what I mean tomorrow. Maybe if your version and simo's version have a baby.. it will work with webmaps and even retain basemaps..  

Hello Kevin. When this widget was enhanced, webmaps were not considered to be one of the types of layers to be stored. The current tools saves the current basemap not webmap. I don't use webmaps in my apps, just default basemap or any other  basemaps selected through the basemaps widget (street, satellite...) in WABde. I supposed the "basemaplayers' layer you are referring to, is the save session's attempt to identify the basemap, even though it was not coded to save webmaps. I will re-visit the code to insert code to save the webmap info in the json file for those of you who use webmaps.

Attached is a video that add custom layer, change basemap, add custom drawing and saves them all. 

Anonymous User

Hi Lefteris Koumis, Yes I use only webmaps. The standard flow of creating a webmap and using WebApp Builder (DE)   Remembering what basemap the user has selected, from the standard Basemap widget would be a nice touch. For example if they change from Topo to Esri Imagery. Of course Esri's own Bookmark widget doesn't remember it either. So I suggested that as an Idea for it. If they create the code there you can hopefully simply leverage theirs.

Anyhow I noticed a bug, it seems. Saving All Sessions works fine. But saving a single one, by clicking the Download button, triggers and HTTP 405 error on my server (IIS - Win 2016)  -----    405 - HTTP verb used to access this page is not allowed.  The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.  For example here is my test site SAGIS Property Map Viewer     It also errors out on POST when viewing the site locally inside the WAB node.js server. I have temporarily just commented this routine out.

Perhaps because the code POSTs instead of GETting?  Do you see this on your servers?

I have already tried disabling WebDAV and adding lines in web.config to disable it there as well after seeing suggestions for that on StackExchange. No dice. 

I am running into a error using simo xu's 2019 version of this app. When I add annotation (using the draw widget with 'add the drawing as an operational layer of the map' checked) and try to save a session, I get the message "error getting the layers from the current map". Both my app and map are public, but I am working on a portal not agol. When I uncheck "add the drawing as an operational layer..", I do not get an error message, but the drawing is not saved to my session file. Has anyone else had this problem? 

I have noticed the same behavior - I don't believe that was built into the widget to begin with. If you figure out how to add it please post

I have been unable to load a SavedSession containing a shapefile that was added to the map with the Add Data widget.  Has anyone else experienced this? The downloaded json file appears to show the shapefile, but nothing appears when loaded into the map. Annotations from the Draw Widget work as expected, but I cannot pinpoint the issue with a Shapefile. If it matters, I am using a web map in this app. Any help is appreciated! 

Hello, my question is along the lines of the last three posts from Lisa Merkhofer, Scott Maginity, and Aubree Vaughn. I'm working in portal and created a web app for non-gis users for our organization. The apps give us extra tools via the widgets where web maps have limited functionality. The biggest drawback to the Webapps is that users can't save their sessions. I too have the drawing widget and add data widget in my web app and would like the non-gis users to be able to save their additions to the base web app.

I guess the base question to all of this is what is meant in the description of saving annotation? 

Thank you,

Angie

Is there a way to save the sessions based on the users' login credentials on the ESRI server probably, instead of saving it as a file? For example, whenever I login with my ESRI credentials then I see the previous session regardless of the computer I use?

 

PS: My map layers are just shared with a certain group of people, so when the app starts, it asks for their ESRI login credentials.

GB7

Hello I have a couple of basemaps/ Imagery Layers added to the web map and am using that web map in Web Appbuilder app, when I use this.map.reorderLayer(layer, layerSettings.order), it messes up the layers existing in the current map, and displays the ids of the added layers instead of Layer name.

I suppose its because this.map has ids for existing layers and reordering messes up this.map._layers/LayerList, this widget is unable to do layer reoder as far as I know. Any help on this would be appreciated, Thanks

Version history
Last update:
‎02-06-2016 09:57 AM
Updated by:
Contributors