When you attempt to print a map using the PrintingTools geoprocessing service included with ArcGIS Server, you must provide a JavaScript Object Notation (JSON) representation of the map, including its layer and extent information. The JSON must be structured according to the Esri ExportWebMap specification.
When you use the ArcGIS Web APIs, you don't need to worry about constructing the JSON; the APIs take care of it for you. However, this topic is included for reference in case you ever need to construct the JSON yourself. This might happen if you need to call the PrintingTools service directly or run its source geoprocessing tool Export Web Map from another application.
Note:
For clarity and ease of reading, the JSON examples in this topic are formatted. However, in practice you should pass unformatted JSON through print services.
New at 11.2
- You can have attributes printed out in two forms:
- Layout templates with dynamic text elements
- Report templates
- Added support to work with dynamic text element, table frame element and chart frame element in a layout. You need to use elementOverrides inside layoutOptions for that.
Note:
You can use a print service Get Layout Templates Info task to find out if a layout template has any of these types of elements.
- A new task can be added to your print service named Get Report Templates Info to retrieve elements inside report templates that can be overridden at run time.
- To support overriding report template elements, a new element reportOptions at the top level of Export Web Map specifications.
New at 11.1
- Both Export Web Map and Get Layout Templates Info tasks are enhanced with a Layout_Item_ID parameter. This allows you to pass in the id of a portal item of layout type. Thus eliminate the need to republish your print service when a new layout template is needed.
- the item must be in the same portal where the server, print service running off, is federated with.
- Added a new property, layerType, for operationalLayer. The layerType property specifies the layer type.
New at 11.0
- Added support to turn visibility on or off for a north arrow element in a layout. You need to use elementOverrides inside layoutOptions for that.
Note:
You can use a print service GetLayoutTemplateInfos task to find out if a layout template has a north arrow.
The web map is made of five top-level objects:
{
"mapOptions": {},
"operationalLayers": [],
"baseMap": [],
"exportOptions": {},
"layoutOptions": {},
"reportOptions": {}
}
mapOptions
The object mapOptions is required and defines map display properties.
Syntax: | Example |
---|---|
|
|
Description | |
|
operationalLayers
The operationalLayers list contains all the operational layers to be displayed in the map. The order of the array defines the order of the layers in the map. The type of each layer is defined by the URL resource response. If the resource cannot be determined from the URL, the type property defines the type. For example, a WMS layer requires that you specify "type": "wms". There are some properties common to all types of operational layers, while others are specific to each type of operational layer.
In case of secured layers, specify the token in a layer definition. A user name and password are not supported as part of the URL.
Note:
For a map service, feature service, or image service, use a URL pointing to the REST endpoint of the service. SOAP endpoints are not supported.
Syntax for operational layers |
---|
|
Description |
Note:Properties described below are common to all types of operational layers (for example, map service layer, client side graphics, kml layer, and so on). Therefore, they may not be included in this section for each type of operation layer below.
|
Syntax for a map service layer | Example |
---|---|
|
|
Description | |
|
Syntax for a feature layer | Example |
---|---|
|
|
Description | |
|
Syntax for an image service layer | Example |
---|---|
|
|
Description | |
Note:See the ArcGIS REST API for more information on image service layers. |
Syntax for a WMS service layer | |
---|---|
| |
Description | |
|
Syntax for a KML layer | Example |
---|---|
|
|
Description | |
|
Syntax for a client-side image | Example |
---|---|
|
|
Description | |
|
Syntax for client side graphics | Example | |
---|---|---|
|
| |
Description | ||
|
Syntax for Comma-Separated Values (CSV) file by URL | Example | |
---|---|---|
|
| |
Description | ||
|
Other properties
Note:
See the ArcGIS REST API for more information on the following properties:
- source
- renderer
- symbol
- textSymbol
- labelingInfo
- geometry
- geometryType
- spatialRel
- relationParam
Syntax to define drawingInfo for a temporal renderer | Example |
---|---|
Note:Temporal renderer is not supported by Printing Services published from ArcGIS Pro.
|
|
Syntax to define a symbolAger | |
| |
Syntax to define an agerClassBreakInfo | |
| |
Description | |
|
Geoprocessing result
There are two ways a geoprocessing result can be included:
- When a geoprocessing result comes back as a feature set and is drawn as graphics on the client side, send the result as a feature collection.
- When the result is drawn by a job's result map service, add a new map service layer in operationalLayers and set the URL property to point to the endpoint of the result. For example:
- Geoprocessing result from 10.1 or later version: https://gisserver.domain.com:6080/arcgis/rest/services/GPJobMapServiceName/MapServer/jobs/job_id
- Geoprocessing result from 10.0 and previous: https://gisserver.domain.com/arcgis/rest/services/GPServiceName/GPServer/GPTaskName/jobs/job_id/results/out_param_name
Example: Geoprocessing result as an operational layer that is drawn by a job result map service
"operationalLayers": [
{
"url": "https://gisserver.domain.com:6080/arcgis/rest/services/Buffer/MapServer/jobs/j9aa6c36d59f44829a0daeadb2d0ff87b",
"title": "Geoprocessing Result"
}
]
baseMap
The map contains one baseMap, which has a title, and a baseMapLayers property that contains an ordered list of baseMapLayers. Each baseMapLayer must be in the same spatial reference and tiling scheme. When there is a baseMap, it defines the map's spatial reference.
Syntax for baseMap | Example |
---|---|
|
|
Syntax for Vector Tile Layer as baseMapLayer | Example |
---|---|
Note:Vector Tile Layers are only supported by Printing Services published from ArcGIS Pro.
|
|
Syntax for Bing Maps as a basemapLayer | Example |
---|---|
|
|
Syntax for OpenStreetMap as a basemapLayer | Example |
---|---|
|
|
Description | |
|
Syntax for WebTiledLayer as a basemapLayer | Example |
---|---|
|
|
Description | |
|
Syntax for WMTS as a basemapLayer |
---|
|
exportOptions
This object specifies settings for the output map.
Syntax | Example |
---|---|
|
|
Description | |
|
layoutOptions
This defines settings for different available page layout elements and is only needed when an available layout template is chosen. Page layout elements include title, copyright text, scale bar, author name, custom and dynamic text element, chart frame element and table frame element.
Note:
This option replaces properties of existing elements only. If an element does not exist in the chosen layout template, the related properties are ignored. For example, if a layout template does not have a copyright text element, no new copyright text element gets added to the layout even though copyrightText element is specified in the layoutOptions.
Charts must be fully defined in operation layers before using them as the sources for chart frame elements.
All the properties of this object are optional. When a value of a property is specified, the value of the corresponding page layout element is replaced; otherwise, the existing element is left untouched.
ExportWebMap custom text element | Corresponding dynamic text in ArcGIS Pro |
---|---|
titleText | <dyn type="layout" property="metadata" attribute="title" emptyStr=""/> |
authorText | <dyn type="layout" property="metadata" attribute="contactname" emptyStr=""/> |
copyrightText | <dyn type="layout" property="metadata" attribute="credits" emptyStr=""/> |
Note:
Read about dynamicText in ArcGIS Help for more information.
Syntax | Example |
---|---|
|
|
Description | |
|
reportOptions
This defines settings for different available report elements and is only needed when an available report template is chosen. Report elements include source and related source ids, field list etc.
Note:
This option replaces properties of existing elements only. If an element does not exist in the chosen report template, the related properties are ignored. For example, if a report template does not have a related report, output reports will not have any related records.
All the properties of this object are required.
Send request to Get Report Templates Info task to retrieve what elements are available for each report template.
Syntax | Example |
---|---|
|
|
Description | |
| |
Limitations
Feature-level symbols overridden in notes layers are not supported when the renderer type is class breaks or simple.