Summary
Creates a web map within a portal (Portal for ArcGIS or a local portal) from an MXD (map document). Requires an account that can authenticate with ArcGIS.com or a local portal to publish services and create the web map.
Usage
Valid feature layers inside the input map document will be published as a feature service to the portal set in the ArcGIS Administrator. Raster layers will be converted into a tiled cached service. These two service types will be combined along with the selected basemap to produce the output web map.
Unsupported items inside the map document, such as feature services and basemaps, will be excluded from the resulting services and web map. Warning messages will be provided for each invalid item.
A full link (URL) to the webmap will be presented as the last tool message, as well as a derived output parameter. You will either need to copy this URL, or open your portal content to launch the webmap.
The active portal is set in the ArcGIS Administrator. A default deployment of ArcGIS for Desktop will publish to ArcGIS.com. You will need a named user with publish permissions to publish the services and web map.
If the active portal has been set to a local portal in the ArcGIS Administrator, all outputs will be created there.
To change the active portal and where the outputs are created, you will need to close ArcGIS for Desktop, open the ArcGIS Administrator, and set the new active portal. You can then reopen ArcGIS for Desktop and publish your map to a web map.
Maps which have been defined as a basemap in the active portal will be available for selection from the basemap parameter. These maps are set by a portal administrator. You will need to contact the portal administrator to have a particular basemap added to your portal if you do not see it listed.
If the webmap or services to be created (based on the webmap name) already exist in your portal, an error will be thrown and the tool will not continue. You will either need to choose a new webmap name, or delete items from your portal. The tool will not overwrite or delete any existing services.
The webmap will not be shared within your organization or publicly by default. Use the sharing parameters to set appropriate sharing options for the feature service and webmap to be created.
Syntax
MXDToWebMap_server (Input_map_document, Web_map_name, Summary, Tags, {Layers_to_be_published}, {Basemap}, {Online_folder_name}, {Within_Organization}, {Everyone}, {Groups}, {Username}, {Password})
Parameter | Explanation | Data Type |
Input_map_document | The input map document of layers to convert to a web map in the portal. | ArcMap Document |
Web_map_name | The name of the output web map to be created. | String |
Summary | The summary for the web map. The summary will provide information about the web map itself when found through a search. | String |
Tags | Identifying tags for the web map. The tags will help make your web map more discoverable through searches. Enter multiple tags by using a comma to separate terms. | String |
Layers_to_be_published [Layers_to_be_published,...] (Optional) | The layers to be included in the output web map. By default, the tool tries to convert all layers found inside the map document. Invalid layer types (such as service layers, for example) will be excluded from the web map even if it was provided as input. An empty list will also attempt to create a web map with all layers from the map document. | String |
Basemap [Basemap,...] (Optional) | The Esri basemap to be used in the web map. | String |
Online_folder_name (Optional) | The portal folder in which to create the web map. If the folder does not already exist, it will be created. | String |
Within_Organization (Optional) | Specifies whether the webmap and associated services will be shared and available within your organization.
| Boolean |
Everyone (Optional) | Specifies whether the webmap will be shared and available to everyone.
| Boolean |
Groups [Groups,...] (Optional) | Select the groups to share the webmap and services with. You must be sure the user account publishing the webmap and services belongs to the group and the group is spelled correctly. The tool dialog will validate groups, you can use this as a reference before running the tool from a python script. | String |
Username (Optional) | The username to authenticate with ArcGIS.com or your local ArcGIS for Portal. The account must have publisher permissions. | String |
Password (Optional) | The password to authenticate with ArcGIS.com or your local ArcGIS for Portal. Note the password is passed as plain text but the tool will attempt to make an HTTPS connection. | String Hidden |
Code sample
MXDToWebMap example (Python Window)
The following Python window script demonstrates how to use the MXDToWebMap function in immediate mode.
mxd = arcpy.mapping.MapDocument("CURRENT")
arcpy.MXDToWebMap_server(mxd, "CoffeeShopLocations", "Location of coffee shops", "coffee,map")
MXDToWebMap example 2 (stand-alone script)
Create a web map from a map document from a stand alone script.
import arcpy
# Tool variables
mxd = r"c:\gisProjects\fastfood\fastfood.mxd"
title = "FastFoodSpots"
user = "PortalKing"
pass = "mySecret"
tags = "hamburger, pizza, tacos, salad"
summary = "All the fast food places this side of the Mississippi."
arcpy.MXDToWebMap_server(mxd, title, summary, tags, Username=user, Password=pass)
Environments
This tool does not use any geoprocessing environments.
Licensing information
- ArcGIS Desktop Basic: Yes
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes