Summary
Creates a web map within a portal (like Portal for ArcGIS or your 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.
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 tool will make use of credentials from the current login session withinArcGIS for Desktop. You might be asked to close the tool and log in to the portal from the application: File > Sign-In if you were not already signed in to portal before launching the tool.
The webmap will be published without being shared. You can share the webmap and services with your organization, specific groups, or everyone by managing the content inside portal.
Syntax
MXDToWebMap_server (input_map_document, web_map_name, summary, tags, {layers_to_be_published}, {basemap}, {online_folder_name})
Parameter | Explanation | Data Type |
input_map_document | The input map document of layers to convert to a web map in the portal. | Map 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 |
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")
MXDToWebMap example 2 (stand-alone script)
Create a web map from a map document.
import arcpy
# Tool variables
mxd = r"c:\gisProjects\fastfood\fastfood.mxd"
title = "FastFoodSpots"
Username = "PortalKing"
Password = "mySecret"
Tags = "hamburger, pizza, tacos, salad"
Desc = "All the fast food places this side of the Mississippi, and salad."
arcpy.MXDToWebMap_server(mxd, title, ,username=Username, password=Password, tags=Tags, description=Desc)
Environments
This tool does not use any geoprocessing environments
Licensing Information
- ArcGIS for Desktop Basic: Yes
- ArcGIS for Desktop Standard: Yes
- ArcGIS for Desktop Advanced: Yes