Export Map

Description

The export operation is performed on a map service resource. The result of this operation is a map
image resource. This resource provides information about the
exported map image such as its URL, its width and height, extent
and scale.

Apart from the usual response formats of html and json, users
can also request a format called image while
performing this operation. When users perform an export with the
format of image, the server responds by directly
streaming the image bytes to the client. One must note that with
this approach you don't get any information associated with the
exported map other than the actual image.

Note that the extent displayed in the exported map image may not
exactly match the extent sent in the bbox parameter
when the aspect ratio of the image size does not match
the aspect ratio of thebbox. The aspect ratio is the
height divided by the width. In these cases the extent is re-sized
to prevent map images from appearing stretched. The exported map's
extent is sent along with the json and html responses and may be
used in client side calculations. So it is important that the
client-side code update its extent based on the response.

New in 10.5

Supports the following new parameters.

datumTransformations to provide a desired datum transformation to be applied while features get projected.

mapRangeValues to set values to ranges applicable to all layers with same ranges in the map service.

layerRangeValues to set range values specific layers.

layerParameterValues to set value to parameterized filters to specific layers.

Simple syntax is not supported as an expected value for layerDefs parameter starting 10.5.

New in 10.1

Support for dynamic layers was added with the dynamicLayers
parameter. If dynamicLayers is used in an export
operation request, then layerDefs, layers,
and layerTimeOptions (export operation) parameters are
ignored. Instead, use definitionExpression and layerTimeOptions
available within dynamicLayers to specify these values
in the export operation. Only those layers that are defined in
dynamicLayers are used in the export operation. Layer
drawing order is based on the order of dynamicLayer elements in the
dynamicLayers array, the first dynamicLayer is drawn
on top of the second dynamicLayer.

gdbVersion parameter was introduced. Use this parameter to specify the geodatabase version.

mapScale parameter was introduced. Use this parameter to export a map image at a specific scale, with the map centered around the center of the specified bounding box (bbox).

If map service resource lists hasLiveData to be true, export operations will default the value for time parameter to be [<current server time - defaultTimeWindow>, <current server time>].

New in 10.0

Support for exporting maps based on time was added at 10.0. For time-aware map services, users can use the time parameter to specify the time instant or the time extent for which to export the map. Users can also control time-based behavior on a per-layer basis by using the layerTimeOptions parameter.

layerDefs supports using JSON representation for layer definitions.

Users can provide arguments to the export operation as query parameters. These parameters include the request extent, size information, layer information, transparency etc. The parameter details are provided in the parameters table below.

Request Parameters

Parameter

Details

f

Description: The response format. The default response format is html. If the format is image, the image bytes are directly streamed to the client.

Values: html | json | image | kmz

bbox

Description: (Required) The extent (bounding box) of the exported image. Unless the bboxSR parameter has been specified, the bbox is assumed to be in the spatial reference of the map.

Syntax: <xmin>, <ymin>, <xmax>,
<ymax>

Example: bbox=-104,35.6,-94.32,41

The bbox coordinates should always use a period as the decimal separator even in countries where traditionally a comma is used.

size

Description: The size width *height) of the exported image in pixels. If the size is not specified, an image with a default size of 400 * 400 will be exported.

Syntax: <width>, <height>

Example: size=600,550

dpi

Description: The device resolution of the exported image (dots per inch). If the dpi is not specified, an image with a default DPI of 96 will be exported.

Support for the png32 format was added at 9.3.1. This
format is only available for map services whose supportedImageFormatTypes
property includes PNG32.

layerDefs

Description: Allows you to filter the features of individual layers in the exported map by specifying definition expressions for those layers. Definition expression for a layer that is published with the service will be always honored.

Note:

When filtering the features of individual layers in a mosaic dataset, the client must explicitly specify the definition expression on the parent mosaic dataset layer. The definition expression will not be honored if it is specified on any of the child layers.

Showing or excluding group layers also shows or excludes all groups and sublayers within the group layer (assuming they draw by
default). For example, if you want to show group layer 0 and layer 2 is a sublayer of this group, layer 2 will also display. The same logic applies when excluding a group layer.

transparent

Description: If true, the image will be exported with the background color of the map set as its transparent color. The default is false. Only the .png and .gif formats support transparency. Internet Explorer 6 does not display transparency correctly for png24 image formats.

Values: true | false

time

Description: The time instant or time extent of the exported map image.

A null value specified for start time or end time will represent
infinity for start or end time respectively (for example, time=null,1230768000000).

layerTimeOptions

Description: The time options per layer. Users can indicate whether or not the layer should use the time extent specified by the time parameter or not, whether to draw the layer features cumulatively or not and the time offsets for the layer.

Description: Use dynamicLayers parameter to modify the layer
drawing order, change layer drawing info, and change layer data
source version for this request. New layers (dataLayer) can also be added to the
dynamicLayers based on the map service registered
workspaces.

The order of dynamicLayers array defines the layer
drawing order. The first element of the dynamicLayers
array draws on top of all other layers.

Note:

When defining a dynamic layer, if the layer source is of type mapLayer, then use the id in layer resource as the mapLayerId for the dynamic layer.

Description: Use this parameter to export a map image at a specific scale, with the map centered around the center of the specified bounding box (bbox).

Syntax: mapScale=<scale>

Examples: mapScale=5000000, mapScale=5E6

rotation

Description: Use this parameter to export a map image rotated at a specific angle, with the map centered around the center of the specified bounding box (bbox). It could be positive or negative number.

Description: Use this parameter to apply one or more datum transformations to the map when imageSR is different than the map service's spatial reference. It is an array of transformation elements.

Transformations specified here are used to project features from layers within a map service to imageSR.

Note: while specifying transformation, you need to think about which datum transformation best applicable to project a layer(s) (not the map service) to the imageSR. sourceSpatialReference property in a layer resource reports which spatial reference features are stored in the source dataset.

Description: Allows you to filter the features of individual layers in the exported map by specifying value(s) to an array of pre-authored parameterized filters for those layers. When value is not specified for any parameter in a request, the default value, that is assigned during authoring time, gets used instead.

When a parameterInfo allows multiple values, you must pass them in an array.

Note: Check parameterInfos at the layer resources for the available parameterized filters, their default values and expected data type.