Packagecom.esri.ags.layers
Classpublic class ArcGISDynamicMapServiceLayer
InheritanceArcGISDynamicMapServiceLayer Inheritance DynamicMapServiceLayer Inheritance Layer Inheritance mx.core.UIComponent

Allows you to work with a dynamic map service resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above). A dynamic map service generates images on the fly.

Note that ArcGISDynamicMapServiceLayer, like all layers, extend UIComponent and thus include basic mouse events, for example: click, mouseOut, mouseOver, and mouseDown, as well as other events like show and hide, and general properties, such as alpha and visible.


Example
MXML usage of ArcGISDynamicMapServiceLayer:
 <esri:Map>
     <esri:ArcGISDynamicMapServiceLayer
         url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer"/>
 </esri:Map>

MXML to set specific visible layers:
 <esri:Map>
     <esri:ArcGISDynamicMapServiceLayer id="dynamicCensusBlockPoints"
         url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer">
         <esri:visibleLayers>
             <mx:ArrayCollection>
                 <mx:Number>0</mx:Number> <!-- Show census block points only -->
             </mx:ArrayCollection>
         </esri:visibleLayers>
     </esri:ArcGISDynamicMapServiceLayer>
 </esri:Map>

View the examples.

See also

com.esri.ags.events.LayerEvent
com.esri.ags.events.MapImageEvent
Live sample - Dynamic Map
Live sample - Dynamic Map Layers on/off


Public Properties
 PropertyDefined by
  copyright : String
[read-only] Map copyright as defined by the map service.
ArcGISDynamicMapServiceLayer
  description : String
[read-only] Map description as defined by the map service.
ArcGISDynamicMapServiceLayer
  disableClientCaching : Boolean
If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.
ArcGISDynamicMapServiceLayer
  dpi : Number
The output dpi of the dynamic map service layer.
ArcGISDynamicMapServiceLayer
  fullExtent : Extent
[read-only] Full extent as defined by the map service.
ArcGISDynamicMapServiceLayer
  imageFormat : String
The output image type.
ArcGISDynamicMapServiceLayer
  imageTransparency : Boolean
Whether or not the background of dynamic image is transparent.
ArcGISDynamicMapServiceLayer
  initialExtent : Extent
[read-only] Initial extent as defined by the map service.
ArcGISDynamicMapServiceLayer
 InheritedisInScaleRange : Boolean
Returns true if the current scale of the map is between the maximum and minimum scale of the layer [added in version 1.3].
Layer
  layerDefinitions : Array
Array of layer definition expressions that allows you to filter the features of individual layers in the exported map image.
ArcGISDynamicMapServiceLayer
  layerInfos : Array
[read-only] The available layers in the map service and their default visibility.
ArcGISDynamicMapServiceLayer
 Inheritedloaded : Boolean
When the layer is loaded, the value becomes "true" and layer properties can be accessed.
Layer
 Inheritedmap : Map
A reference to the Map this layer is in.
Layer
 InheritedmaxScale : Number = 0
The maximum scale of the layer [added in version 1.3].
Layer
 InheritedminScale : Number = 0
The minimum scale of the layer [added in version 1.3].
Layer
  proxyURL : String
The URL to proxy the request through.
ArcGISDynamicMapServiceLayer
  requestTimeout : Number = -1
The request timeout in seconds.
ArcGISDynamicMapServiceLayer
  serviceDescription : String
[read-only] Map service description as defined by the map service.
ArcGISDynamicMapServiceLayer
  spatialReference : SpatialReference
[read-only] The spatial reference of the map service.
ArcGISDynamicMapServiceLayer
  token : String
Token for accessing a secure dynamic ArcGIS service.
ArcGISDynamicMapServiceLayer
  units : String
[read-only] The units of the layer.
ArcGISDynamicMapServiceLayer
  url : String
URL endpoint of a service.
ArcGISDynamicMapServiceLayer
  visibleLayers : ArrayCollection
Sets the visible layers of the exported map.
ArcGISDynamicMapServiceLayer
Public Methods
 MethodDefined by
  
ArcGISDynamicMapServiceLayer(url:String = null, proxyURL:String = null, token:String = null)
Creates a new ArcGISDynamicMapServiceLayer object.
ArcGISDynamicMapServiceLayer
  
Clears the visible layers as defined in visibleLayers and resets to the default layers of the map service.
ArcGISDynamicMapServiceLayer
  
exportMapImage(imageParameters:ImageParameters = null, responder:IResponder = null):void
Exports a map using values from the layer as defaults.
ArcGISDynamicMapServiceLayer
  
getLayerDetails(layerID:Number, responder:IResponder):void
Gets the detailed layer information for an ArcGIS layer.
ArcGISDynamicMapServiceLayer
 Inherited
refresh():void
Causes the layer to redraw or reload its content.
Layer
Protected Methods
 MethodDefined by
 Inherited
Adds listeners for ExtentEvent.EXTENT_CHANGE, ZoomEvent.ZOOM_START, ZoomEvent.ZOOM_UPDATE and ZoomEvent.ZOOM_END.
Layer
 Inherited
When an EXTENT_CHANGE event occurs, this calls invalidateLayer();
Layer
 Inherited
hideHandler(event:FlexEvent):void
When the layer is hidden (visible is set to false), this calls removeMapListeners().
Layer
 Inherited
Subclasses should call this whenever they would like to have updateLayer() called on them.
Layer
 Inherited
loadMapImage(loader:Loader):void
Subclasses must override this method.
DynamicMapServiceLayer
 Inherited
Removes all the layers children.
Layer
 Inherited
Removes the four event listeners added by addMapListeners();
Layer
 Inherited
setLoaded(value:Boolean):void
Subclasses must call this when they've loaded all their properties and are ready to load their content.
Layer
 Inherited
showHandler(event:FlexEvent):void
When the layer is shown (visible is set to true), this calls addMapListeners() and invalidateLayer().
Layer
 Inherited
toScreenX(mapX:Number):Number
Converts the x-coordinate of map point to a screen point.
Layer
 Inherited
toScreenY(mapY:Number):Number
Converts the y-coordinate of map point to a screen point.
Layer
 Inherited
updateLayer():void
Subclasses must override this method.
Layer
 Inherited
Finishes the zoom animation.
Layer
 Inherited
Prepares the zoom animation by taking a bitmap of the layer.
Layer
 Inherited
Redraws the bitmap of the layer.
Layer
Events
 EventSummaryDefined by
 Inherited Dispatched when the download of the map image is complete.DynamicMapServiceLayer
 Inherited Dispatched when an input/output error occurs when downloading the map image.DynamicMapServiceLayer
 Inherited Fires after layer properties for the layer are successfully populated.Layer
 Inherited Fires if the layer is unable to load.Layer
   Dispatched when the map export is completed.ArcGISDynamicMapServiceLayer
Property detail
copyrightproperty
copyright:String  [read-only]

Map copyright as defined by the map service.

This property can be used as the source for data binding.

Implementation
    public function get copyright():String
descriptionproperty 
description:String  [read-only]

Map description as defined by the map service.

This property can be used as the source for data binding.

Implementation
    public function get description():String
disableClientCachingproperty 
disableClientCaching:Boolean  [read-write]

If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.

The default value is false.

This property can be used as the source for data binding.

Implementation
    public function get disableClientCaching():Boolean
    public function set disableClientCaching(value:Boolean):void
dpiproperty 
dpi:Number  [read-write]

The output dpi of the dynamic map service layer.

The default value is 96.

This property can be used as the source for data binding.

Implementation
    public function get dpi():Number
    public function set dpi(value:Number):void
fullExtentproperty 
fullExtent:Extent  [read-only]

Full extent as defined by the map service.

This property can be used as the source for data binding.

Implementation
    public function get fullExtent():Extent
imageFormatproperty 
imageFormat:String  [read-write]

The output image type. Valid types are: png8 | png24 | png32 | jpg | gif. Only png and gif formats support transparency.

The default value is png8.

This property can be used as the source for data binding.

Implementation
    public function get imageFormat():String
    public function set imageFormat(value:String):void
imageTransparencyproperty 
imageTransparency:Boolean  [read-write]

Whether or not the background of dynamic image is transparent. Only png and gif formats support transparency.

The default value is true.

This property can be used as the source for data binding.

Implementation
    public function get imageTransparency():Boolean
    public function set imageTransparency(value:Boolean):void

See also

initialExtentproperty 
initialExtent:Extent  [read-only]

Initial extent as defined by the map service. Used for the map if it's the first layer in the map and map doesn't have an extent specified.

This property can be used as the source for data binding.

Implementation
    public function get initialExtent():Extent
layerDefinitionsproperty 
layerDefinitions:Array  [read-write]

Array of layer definition expressions that allows you to filter the features of individual layers in the exported map image. Definition expressions for layers that are currently not visible will be ignored by the server.

This property can be used as the source for data binding.

Implementation
    public function get layerDefinitions():Array
    public function set layerDefinitions(value:Array):void

See also

layerInfosproperty 
layerInfos:Array  [read-only]

The available layers in the map service and their default visibility.

This property can be used as the source for data binding.

Implementation
    public function get layerInfos():Array

See also

proxyURLproperty 
proxyURL:String  [read-write]

The URL to proxy the request through.

This property can be used as the source for data binding.

Implementation
    public function get proxyURL():String
    public function set proxyURL(value:String):void
requestTimeoutproperty 
public var requestTimeout:Number = -1

The request timeout in seconds. A value less than or equal to zero prevents request timeout.

serviceDescriptionproperty 
serviceDescription:String  [read-only]

Map service description as defined by the map service.

This property can be used as the source for data binding.

Implementation
    public function get serviceDescription():String
spatialReferenceproperty 
spatialReference:SpatialReference  [read-only]

The spatial reference of the map service.

This property can be used as the source for data binding.

Implementation
    public function get spatialReference():SpatialReference
tokenproperty 
public var token:String

Token for accessing a secure dynamic ArcGIS service.

unitsproperty 
units:String  [read-only]

The units of the layer. Subclasses should override this method as a best practice in case a subclassed layer is added to a map which has different "units".

This property can be used as the source for data binding.

Implementation
    public function get units():String

See also

urlproperty 
url:String  [read-write]

URL endpoint of a service. To obtain the URL, use ArcGIS Services Directory. An example URL for a dynamic map service is http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer.

This property can be used as the source for data binding.

Implementation
    public function get url():String
    public function set url(value:String):void
visibleLayersproperty 
visibleLayers:ArrayCollection  [read-write]

Sets the visible layers of the exported map. By default, the visible layers are as defined by the default visibility in LayerInfo.

This property can be used as the source for data binding.

Implementation
    public function get visibleLayers():ArrayCollection
    public function set visibleLayers(value:ArrayCollection):void

See also

Constructor detail
ArcGISDynamicMapServiceLayer()constructor
public function ArcGISDynamicMapServiceLayer(url:String = null, proxyURL:String = null, token:String = null)

Creates a new ArcGISDynamicMapServiceLayer object.

Parameters
url:String (default = null) — URL to the ArcGIS Server REST resource that represents a map service.
 
proxyURL:String (default = null) — The URL to proxy the request through.
 
token:String (default = null) — Token for accessing a secure dynamic ArcGIS service.
Method detail
defaultVisibleLayers()method
public function defaultVisibleLayers():void

Clears the visible layers as defined in visibleLayers and resets to the default layers of the map service.

exportMapImage()method 
public function exportMapImage(imageParameters:ImageParameters = null, responder:IResponder = null):void

Exports a map using values from the layer as defaults. On completion, MapImage is returned. The mapImageExport event is also fired.

Parameters
imageParameters:ImageParameters (default = null) — Input parameters to use when exporting the map image. Non-null properties override the layer's values.
 
responder:IResponder (default = null) — IResponder to pass the MapImage result to.

See also

getLayerDetails()method 
public function getLayerDetails(layerID:Number, responder:IResponder):void

Gets the detailed layer information for an ArcGIS layer. On completion, LayerDetails is returned.

Parameters
layerID:Number — Layer ID assigned by ArcGIS Server for a layer.
 
responder:IResponder — IResponder to pass the LayerDetails result to.

See also

Event detail
mapImageExportevent 
Event object type: com.esri.ags.events.MapImageEvent
MapImageEvent.type property = com.esri.ags.events.MapImageEvent.EXPORT

Dispatched when the map export is completed.

Defines the value of the type property of a mapImageExport event object.

Examples
ArcGISDynamicMapServiceLayer
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:esri="http://www.esri.com/2008/ags"
    pageTitle="Example - ArcGIS API for Flex connecting to a dynamic AGS service">
    <esri:Map>
        <esri:ArcGISDynamicMapServiceLayer
            url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer"/>
    </esri:Map>
</mx:Application>