Description
Allows you to work with a dynamic map service resource exposed by the ArcGIS Server REST API. A dynamic map service generates images on the fly. For cached map services, see
ArcGISTiledMapServiceLayer.
If the first layer added to the map is an ArcGISDynamicMapServiceLayer, the map will take on the projection of this layer.
Class hierarchy
esri.Layer
|_ esri.layers.DynamicMapServiceLayer
|_ esri.layers.ArcGISDynamicMapServiceLayer
Constructor
Properties
| copyright |
String
|
Copyright string as defined by the map service. |
| description |
String
|
Map description as defined by the map service. |
| disableClientCaching |
Boolean
|
When true, images are always requested from the server and the browser's cache is ignored. This should be used when the data supporting the map service changes frequently. |
| dpi |
Number
|
The output dpi of the dynamic map service layer. |
| imageFormat |
String
|
The output image type. As of ArcGIS Server 9.3.1, the list of supported image formats is included in the description of Map Services in Services Directory under "Supported Image Format Types". In addition, as of ArcGIS Server 9.3.1, optimized map services can produce true PNG32 images. |
| imageTransparency |
Boolean
|
Whether or not background of dynamic image is transparent. |
| layerDefinitions |
String[]
|
Sets the layer definitions used to filter the features of individual layers in the map service. |
| layerInfos |
LayerInfo[]
|
Returns the available layers in service and their default visibility. |
| units |
String
|
Default units of the layer as defined by the service. If the layer is the base map, the map is in these units. |
| useMapImage |
Boolean
|
When true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. A second call is automatically made to the server to retrieve the image. This value is set in the constructor using useMapImage. |
| visibleLayers |
Number[]
|
Gets the visible layers of the exported map. |
Methods
| exportMapImage(imageParameters?, callback?) |
none
|
Exports a map using values as specified by ImageParameters. On completion, MapImage is returned. |
| setDefaultLayerDefinitions() |
none
|
Resets all layer definitions to those defined in the service. |
| setDefaultVisibleLayers() |
none
|
Clears the visible layers as defined in setVisibleLayers, and resets to the default layers of the map service. |
| setDisableClientCaching(disable) |
none
|
Sets whether images are always requested from the server and the browser's cache is ignored. This should be used when the data supporting the map service changes frequently. |
| setDPI(dpi) |
none
|
Sets the dpi of the exported map. The default value is 96. |
| setImageFormat(imageFormat) |
none
|
Sets the image format of the exported map. |
| setImageTransparency(transparent) |
none
|
Sets the background of a dynamic image to transparent. |
| setLayerDefinitions(layerDefinitions) |
none
|
Sets the layer definitions used to filter the features of individual layers in the map service. The layerDefinitions argument is an array of layer definition expressions such as in the code snippet below:
var layerDefinitions = [];
layerDefinitions[0] = "POPULATION > 5000000";
layerDefinitions[5] = "AREA > 100000";
dynamicMapServiceLayer.setLayerDefinitions(layerDefinitions);
Note that the array indices 0 and 5 are valid layer IDs, and POPULATION and AREA are valid attribute fields associated with the respective layers. Definition expressions for layers that are currently not visible will be ignored by the server. |
| setVisibleLayers(ids) |
none
|
Sets the visible layers of the exported map. By default, the visible layers are as defined by the default visibility in LayerInfo. |
Events
Constructor Detail
esri.layers.ArcGISDynamicMapServiceLayer(url, options?)
Creates a new ArcGISDynamicMapServiceLayer object. A URL is a required parameter. This layer also takes some optional parameters. These optional parameters can be included in any order.
Parameters:
|
<String>
url |
Required |
URL to the ArcGIS Server REST resource that represents a map service. An example is
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer. For more information on constructing a URL, see The Services Directory and the REST API.
|
|
<Object>
options |
Optional |
Optional parameters. See options list.
|
Options:
|
<String>
id |
Id to assign to the layer. If not assigned, esri.Map assigns value.
|
|
<ImageParameters>
imageParameters |
Represents the image parameter options.
|
|
<Number>
opacity |
Initial opacity or transparency of layer. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency. The default value is 1.0.
|
|
<Boolean>
useMapImage |
By default, images are exported in MIME format, and the image is streamed to the client. When useMapImage is set to true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. A second call is automatically made to the server to retrieve the image. This methodology is required for secure services that go through a proxy server. In this situation, a map image cannot be streamed. (As of v1.2)
|
|
<Boolean>
visible |
Initial visibility of the layer. Default is true.
|
Properties Detail
Copyright string as defined by the map service.
Map description as defined by the map service.
<Boolean> disableClientCaching
When true, images are always requested from the server and the browser's cache is ignored. This should be used when the data supporting the map service changes frequently. (As of v1.2)
Known values: true | false
Default value: false
The output dpi of the dynamic map service layer.
Default value: 96
The output image type. As of ArcGIS Server 9.3.1, the list of supported image formats is included in the description of Map Services in Services Directory under "Supported Image Format Types". In addition, as of ArcGIS Server 9.3.1, optimized map services can produce true PNG32 images.
Known values: png | png8 | png24 | png32 | jpg | pdf | bmp | gif | svg
Default value: png8
<Boolean> imageTransparency
Whether or not background of dynamic image is transparent.
Known values: true | false
Default value: true
<String[]> layerDefinitions
Sets the layer definitions used to filter the features of individual layers in the map service. (As of v1.2)
Returns the available layers in service and their default visibility.
Default units of the layer as defined by the service. If the layer is the base map, the map is in these units.
When true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. A second call is automatically made to the server to retrieve the image. This value is set in the constructor using useMapImage. (As of v1.2)
Known values: true | false
Default value: false
Gets the visible layers of the exported map. (As of v1.2)
Methods Detail
exportMapImage(imageParameters?, callback?)
Return value: none
Input Parameters:
|
<ImageParameters> imageParameters |
Optional |
Input parameters assigned before exporting the map image. |
|
<Function> callback |
Optional |
The function to call when the method has completed. The arguments in the function are the same as the onMapImageExport event. |
setDefaultLayerDefinitions()
Resets all layer definitions to those defined in the service. (As of v1.1)
Return value: none
setDefaultVisibleLayers()
Clears the visible layers as defined in
setVisibleLayers, and resets to the default layers of the map service.
Return value: none
setDisableClientCaching(disable)
Sets whether images are always requested from the server and the browser's cache is ignored. This should be used when the data supporting the map service changes frequently. (As of v1.2)
Return value: none
Input Parameters:
|
<Boolean> disable |
Required |
When true, client side caching is disabled. |
Sets the dpi of the exported map. The default value is 96.
Return value: none
Input Parameters:
|
<Number> dpi |
Required |
DPI value. |
setImageFormat(imageFormat)
Sets the image format of the exported map.
Return value: none
Input Parameters:
|
<String> imageFormat |
Required |
Valid values are png | png8 | png24 | jpg | pdf | bmp | gif | svg. |
setImageTransparency(transparent)
Sets the background of a dynamic image to transparent.
Return value: none
Input Parameters:
|
<Boolean> transparent |
Required |
Valid values are true | false. The default is "true". |
setLayerDefinitions(layerDefinitions)
Sets the layer definitions used to filter the features of individual layers in the map service. The layerDefinitions argument is an array of layer definition expressions such as in the code snippet below:
var layerDefinitions = [];
layerDefinitions[0] = "POPULATION > 5000000";
layerDefinitions[5] = "AREA > 100000";
dynamicMapServiceLayer.setLayerDefinitions(layerDefinitions);
Note that the array indices 0 and 5 are valid layer IDs, and POPULATION and AREA are valid attribute fields associated with the respective layers. Definition expressions for layers that are currently not visible will be ignored by the server.
Return value: none
Input Parameters:
|
<String[]> layerDefinitions |
Required |
An array containing each layer's definition. |
Sets the visible layers of the exported map. By default, the visible layers are as defined by the default visibility in
LayerInfo.
Return value: none
Input Parameters:
|
<Number[]> ids |
Required |
Array of layer IDs. |
Events Detail
onMapImageExport(mapImage)
Fires when the map export is completed.
Arguments:
|
<MapImage> mapImage
|
Contains the properties of a dynamically generated map image.
|