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.
The web map is made of five top-level objects:
{
"mapOptions": {},
"operationalLayers": [],
"baseMap": [],
"exportOptions": {},
"layoutOptions": {}
}
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 |
---|---|
|
|
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: http://gisserver.domain.com:6080/arcgis/rest/services/GPJobMapServiceName/MapServer/jobs/job_id
- Geoprocessing result from 10.0 and previous: http://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" : "http://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 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, and custom text elements.
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.
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 text element | Corresponding dynamic text in ArcMap |
---|---|
titleText | <dyn type="document" property="title" /> |
authorText | <dyn type="document" property="author" /> |
copyrightText | <dyn type="document" property="credits" /> |
Note:
Read about dynamicText in ArcGIS Help for more information.
Syntax | Example |
---|---|
|
|
Description | |
|
Limitations
Feature-level symbols overridden in notes layers are not supported when the renderer type is class breaks or simple.