com.esri.android.map.ags
Class ArcGISDynamicMapServiceLayer

java.lang.Object
  extended by com.esri.android.map.Layer
      extended by com.esri.android.map.DynamicLayer
          extended by com.esri.android.map.ags.ArcGISDynamicMapServiceLayer

public class ArcGISDynamicMapServiceLayer
extends DynamicLayer

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);
 

Since:
1.0

Field Summary
 
Fields inherited from class com.esri.android.map.Layer
credentials, nativeHandle, popUpInfos, serviceInfo
 
Constructor Summary
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)
          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, int[] visiblelayers, UserCredentials credentials)
          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.
 
Method Summary
 ArcGISLayerInfo[] getAllLayers()
          Returns the all of sub-layers of the dynamic map service.
 String getCapabilities()
          Gets the capabilities of the map service.
protected  byte[] getImage(int width, int height, Envelope extent)
           
 Map<Integer,String> getLayerDefinitions()
          Gets the layer definitions of the ArcGISDynamicMapServiceLayer.
 ArcGISLayerInfo[] getLayers()
          Returns the immediate sub-layers of the dynamic map service.
protected  void initLayer()
          Initializes the layer.
 boolean retrieveLegendInfo()
          Supported on ArcGIS Server 10.01 and above.
Synchronously retrieves the legend information for all the layer infos.
 void setLayerDefinitions(Map<Integer,String> layerDefs)
          Sets the layer definitions used to filter the features of individual layers in the map service.
 
Methods inherited from class com.esri.android.map.DynamicLayer
cancelPendingTasks, create, getBrightness, getContrast, getGamma, getImageAsych, recycle, refresh, requestImage, setBrightness, setContrast, setGamma
 
Methods inherited from class com.esri.android.map.Layer
changeStatus, finalize, getCredentials, getDefaultSpatialReference, getDpi, getExtent, getFullExtent, getHeight, getID, getInitialExtent, getName, getOpacity, getParent, getPoolExecutor, getPopupInfo, getQueryUrl, getResolution, getServiceExecutor, getSpatialReference, getTitle, getUrl, getUrlHashCode, getWidth, isInitialized, isRecycled, isShowLegend, isVisible, isWebMapBaselayer, loadServiceInfo, lock, reinitializeLayer, setCredentials, setDefaultSpatialReference, setFullExtent, setInitialExtent, setName, setOnStatusChangedListener, setOpacity, setPopupInfos, setQueryUrls, setUrl, setVisible, unlock, updateSpatialReferenceStatus, verifyCredentials
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArcGISDynamicMapServiceLayer

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.
Since:
1.0

ArcGISDynamicMapServiceLayer

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.
Since:
1.0

ArcGISDynamicMapServiceLayer

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.
Since:
2.0

ArcGISDynamicMapServiceLayer

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.
Since:
1.0

ArcGISDynamicMapServiceLayer

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
Since:
1.0
Method Detail

initLayer

protected void initLayer()
Description copied from class: Layer
Initializes the layer. The implementation should submit the OnStatusChangedListener.STATUS event accordingly.

Overrides:
initLayer in class DynamicLayer

getCapabilities

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.
Since:
1.0

getLayers

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:
an array of type ArcGISLayerInfo. ArcGISLayerInfo.getLayers() to get the sub-layer of the group layer.
Since:
1.0

getAllLayers

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:
an array of type ArcGISLayerInfo.
Since:
1.0

getImage

protected byte[] getImage(int width,
                          int height,
                          Envelope extent)
                   throws Exception
Specified by:
getImage in class DynamicLayer
Throws:
Exception

getLayerDefinitions

public Map<Integer,String> getLayerDefinitions()
Gets the layer definitions of the ArcGISDynamicMapServiceLayer.

Returns:
Returns the layerDefs.
Since:
1.0
See Also:
setLayerDefinitions(Map)

setLayerDefinitions

public void setLayerDefinitions(Map<Integer,String> 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.
Since:
1.0

retrieveLegendInfo

public boolean retrieveLegendInfo()
Supported on ArcGIS Server 10.01 and above.
Synchronously retrieves the legend information for all the layer infos. Once finished, ArcGISLayerInfo.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.

Returns:
boolean
Since:
2.0


Copyright © 2010. All Rights Reserved.