- Map title and description
- Copyright information
- A thumbnail image
and map content, for example:
- The map's basemap
- A list of operational layers
- Information about layer visibility and rendering
- Layer scale thresholds
- The map's initial viewpoints
No matter how you create this map you can save it either as a brand new map or, if you have made any changes to the map, you can save it back to its original map. This topic describes how to save a brand new map and how to save back any changes you've made to an existing map.
Save a new map to a portal
When you save a new map to the portal you will create a new portal item with a type of WebMap that has a new unique item ID. The new portal item will be placed in the My Content area of the user that was authenticated with the portal. When you save the map for the first time you must provide at least a map title, a set of tags used to describe the map for searches, and a loaded portal object. You can also set these properties if you wish.
- Folder—a portal folder (PortalFolder) in which the map will be placed in My Content. By default the map will be saved to the user's root folder.
- Description—a description of the map.
- Thumbnail—an image (RuntimeImage) that will be associated with the portal item and is shown on the portal item details page in ArcGIS Online or ArcGIS Enterprise.
- Force save to supported version—a boolean flag to indicate whether or not the map should be saved as the web map version supported by the API. This may cause data loss, as data unknown to the supported format will be lost when the map is saved.
The following example illustrates saving the map with the asynchronous SaveAsAsync method and returning a new PortalItem.
// export the current map view to use as the thumbnail
var thumbnailImage = await MyMapView.ExportImageAsync();
// save the map to create a new portal item
var newPortalItem = await MyMapView.Map.SaveAsAsync(
myPortal, // a portal with which the user has authenticated
null, // folder ID (or null for the user's default folder)
TitleTextBox.Text, // title
DescriptionTextBox.Text, // description
TagsTextBox.Text.Split(','), // tags (keywords) used to identify the item in a search
thumbnailImage, // the exported RuntimeImage for the item's thumbnail
true); // force the save to use the supported web map version
The overload of SaveAsAsync that takes a System.Uri for the thumbnail image has been deprecated. If passing a thumbnail image, use the recommended overload that takes an Esri.ArcGISRuntime.UI.RuntimeImage object.
Access the map's item properties
After the map saving has completed, the map’s portal item property is populated with the brand new portal item properties. You can access all of the properties and set any of the writeable properties, as you require.
// get the portal item that represents the map
PortalItem webMapPortalItem = MyMapView.Map.Item as PortalItem;
// provide a new title for the portal item
webMapPortalItem.Title = TitleTextBox.Text;
// provide a 'Snippet' (a more succinct version of the description)
webMapPortalItem.Snippet = SnippetTextBox.Text;
// report how many times the item has been viewed
var message = "Web map portal item (id=" + webMapPortalItem.ItemId + ")" +
" has been viewed " + webMapPortalItem.ViewCount.ToString() + " times.";
If you wish to save any of these properties, call the map's save method as described in the following section.
Share the map
After the map has been saved to the portal, the map is available to share with other portal users. See the share a portal item topic for more information.
Save changes to an existing web map
If you have opened a map, made changes to the map content or properties, and you want to save changes back to that map, then call the asynchronous save method on the map. This method, of course, requires that the map has been previously saved to the portal and an exception will be raised if it has not. If a layer in your map allows users to edit offline, be sure to sync their edits in addition to saving the map.
// save changes to the portal item properties
Console.WriteLine("Unable to save the web map portal item: " + ex.Message);