public class

ArcGISDynamicMapServiceLayer

extends DynamicLayer
implements TimeAwareLayer
java.lang.Object
   ↳ com.esri.android.map.Layer
     ↳ com.esri.android.map.DynamicLayer
       ↳ com.esri.android.map.ags.ArcGISDynamicMapServiceLayer

Class Overview

The ArcGISDynamicMapServiceLayer class allows you to work with a dynamic map service resource that is exposed by the ArcGIS Server REST API (see the system requirements document for supported versions of ArcGIS Server). A dynamic map service generates map images on the server each time a request comes in.

The following are examples of how you might work with the ArcGISDynamicMapServiceLayer class. The code will add a map service from ArcGIS Online using map services that are dynamically retrieved. When working with dynamic services the ArcGISDynamicMapServiceLayer class must be used. This example code shows you how to connect to ArcGIS Online, but you can easily update the code to point to your own ArcGIS Server REST end points. Java usage:

 //ArcGISDynamicMapServiceLayer class is used to define the Layer that is added to the
 //MapView object.
 MapView mv = new MapView(this);
 mv.addLayer(new ArcGISDynamicMapServiceLayer(
 "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer"));
 setContentView(mv);
 

Summary

[Expand]
Inherited Fields
From class com.esri.android.map.DynamicLayer
From class com.esri.android.map.Layer
Public Constructors
ArcGISDynamicMapServiceLayer(String url, int[] visiblelayers)
This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer.
ArcGISDynamicMapServiceLayer(String url, int[] visiblelayers, UserCredentials credentials, boolean initLayer)
This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer.
ArcGISDynamicMapServiceLayer(String url, int[] visiblelayers, int[] invisibleLegendLayers, UserCredentials credentials, boolean initLayer)
This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer.
ArcGISDynamicMapServiceLayer(String url)
This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer (see the class description for an example of this usage).
ArcGISDynamicMapServiceLayer(String url, int[] visiblelayers, UserCredentials credentials)
This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer.
Public Methods
ArcGISPopupInfo createPopupInfo(int sublayerId)
Creates the popup info.
ArcGISLayerInfo[] getAllLayers()
Returns the all of sub-layers of the dynamic map service.
String getCapabilities()
Gets the capabilities of the map service.
Map<IntegerString> getLayerDefinitions()
Gets the layer definitions of the ArcGISDynamicMapServiceLayer.
ArcGISLayerInfo[] getLayers()
Returns the immediate sub-layers of the dynamic map service.
ArcGISPopupInfo getPopupInfo(int sublayerId)
Gets the PopupInfo associated with the sub-layer id.
TimeExtent getTimeExtent()
Gets the valid TimeExtent object for the Layer or null if this service does not support time based queries.
TimeInfo getTimeInfo()
Get all the time awareness information for this layer.@return
TimeExtent getTimeInterval()
Get the current date/time range that this layer is filtered by.
Map<IntegerTimeOptions> getTimeOptions()
This method will return a list of.
boolean isTimeAware()
Indicates whether or not this particular layer instance is time aware.
boolean retrieveLegendInfo()
Supported on ArcGIS Server 10.01 and above.
void setLayerDefinitions(Map<IntegerString> layerDefs)
Sets the layer definitions used to filter the features of individual layers in the map service.
void setTimeInterval(TimeExtent timeInterval)
Set the current date/time range that this layer will be filtered by.
void setTimeOptions(Map<IntegerTimeOptions> timeOptions)
Set a list of LayerTimeOptions.
Protected Methods
byte[] getImage(int width, int height, Envelope extent)
void initLayer()
Initializes the layer.
[Expand]
Inherited Methods
From class com.esri.android.map.DynamicLayer
From class com.esri.android.map.Layer
From class java.lang.Object
From interface com.esri.android.map.popup.PopupLayer
From interface com.esri.core.map.TimeAwareLayer

Public Constructors

public ArcGISDynamicMapServiceLayer (String url, int[] visiblelayers)

This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer.

Parameters
url the URL of the dynamic map service.
visiblelayers the IDs of the layers are visible. Set to null if all layers are visible.

public ArcGISDynamicMapServiceLayer (String url, int[] visiblelayers, UserCredentials credentials, boolean initLayer)

This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer.

Parameters
url the URL of the dynamic map service.
visiblelayers the IDs of the layers are visible. Set to null if all layers are visible.
credentials the credentials used for accessing a secure dynamic map service
initLayer set to true to initialize the layer.

public ArcGISDynamicMapServiceLayer (String url, int[] visiblelayers, int[] invisibleLegendLayers, UserCredentials credentials, boolean initLayer)

This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer.

Parameters
url the URL of the dynamic map service.
visiblelayers the IDs of the layers are visible. Set to null if all layers are visible.
invisibleLegendLayers the IDs of the layers which legends are invisible. Set to null if all layers legend are visible.
credentials the credentials used for accessing a secure dynamic map service
initLayer set to true to initialize the layer.

public ArcGISDynamicMapServiceLayer (String url)

This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer (see the class description for an example of this usage).

Parameters
url the URL of the dynamic map service.

public ArcGISDynamicMapServiceLayer (String url, int[] visiblelayers, UserCredentials credentials)

This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer.

Parameters
url the URL of the dynamic map service.
visiblelayers the IDs of the layers are visible. Set to null if all layers are visible.
credentials the credentials used for accessing a secure dynamic map service

Public Methods

public ArcGISPopupInfo createPopupInfo (int sublayerId)

Creates the popup info.

Parameters
sublayerId the sublayer id
Returns
  • the arc gis popup info

public ArcGISLayerInfo[] getAllLayers ()

Returns the all of sub-layers of the dynamic map service. See getLayers() if you need the layer returned in hierarchy.

Returns

public String getCapabilities ()

Gets the capabilities of the map service. It is a comma separated list of supported capabilities - e.g. "Map, Query, Data". Only available if the map service is published using ArcGIS Server version 10 or greater. You can not call this method until the layer is loaded.

Returns
  • the comma separated capabilities or null if the associated server doesn't support it.

public Map<IntegerString> getLayerDefinitions ()

Gets the layer definitions of the ArcGISDynamicMapServiceLayer.

Returns
  • Returns the layerDefs.

public ArcGISLayerInfo[] getLayers ()

Returns the immediate sub-layers of the dynamic map service. If a layer is a group layer, you can call the

Returns

public ArcGISPopupInfo getPopupInfo (int sublayerId)

Gets the PopupInfo associated with the sub-layer id.

Parameters
sublayerId the sublayer id
Returns

public TimeExtent getTimeExtent ()

Gets the valid TimeExtent object for the Layer or null if this service does not support time based queries.

Returns
  • the valid range of dates for this layer.

public TimeInfo getTimeInfo ()

Get all the time awareness information for this layer.@return

public TimeExtent getTimeInterval ()

Get the current date/time range that this layer is filtered by.

Returns
  • the current date/time range

public Map<IntegerTimeOptions> getTimeOptions ()

This method will return a list of.

Returns
  • list of LayerTimeOptions instances com.esri.core.internal.value.LayerTimeOptions LayerTimeOptions that can be used to indicate whether or not each layer should use the time extent specified by the TimeInterval property or not, whether to draw the layer features cumulatively or not and the time offsets for the layer. If this property has not been previously set by the user, the returned Map will be empty.

public boolean isTimeAware ()

Indicates whether or not this particular layer instance is time aware.

Returns
  • True if this is a time aware layer, false otherwise.

public boolean retrieveLegendInfo ()

Supported on ArcGIS Server 10.01 and above.
Synchronously retrieves the legend information for all the layer infos. Once finished,

Returns
  • boolean getLegend() may be called on the individual ArcGISLayerInfos that make up this ArcGISDynamicMapServiceLayer.

    Note: The developer is responsible for calling this method in a non-UI thread.

public void setLayerDefinitions (Map<IntegerString> layerDefs)

Sets the layer definitions used to filter the features of individual layers in the map service.

Java sample:

 layer = new ArcGISDynamicMapServiceLayer("http://yourhost/MapServer");
 HashMap<Integer, String> layerDefs = new HashMap<Integer, String>();
 layerDefs.put(Integer.valueOf(1), "pop1990 > 5000000");
 layer.setLayerDefinitions(layerDefs);
 
 map.addLayer(layer);
 

Parameters
layerDefs The layerDefs to set. The key is the index of the sublayer, the value is the where clause.

public void setTimeInterval (TimeExtent timeInterval)

Set the current date/time range that this layer will be filtered by.

Parameters
timeInterval the new date/time range

public void setTimeOptions (Map<IntegerTimeOptions> timeOptions)

Set a list of LayerTimeOptions.

Parameters
timeOptions list of LayerTimeOptions to apply to this layer

Protected Methods

protected byte[] getImage (int width, int height, Envelope extent)

Throws
Exception

protected void initLayer ()

Initializes the layer. The implementation should submit the OnStatusChangedListener.STATUS event accordingly.