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


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, 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.
 Map<Integer,String> getLayerDefinitions()
          Gets the layer definitions of the ArcGISDynamicMapServiceLayer.
 ArcGISLayerInfo[] getLayers()
          Returns the immediate sub-layers of the dynamic map service.
 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, getBrightness, getContrast, getGamma, recycle, refresh, setBrightness, setContrast, setGamma
 
Methods inherited from class com.esri.android.map.Layer
getCredentials, getDefaultSpatialReference, getExtent, getFullExtent, getHeight, getID, getName, getOpacity, getPopupInfo, getResolution, getSpatialReference, getTitle, getUrl, getUrlHashCode, getWidth, isInitialized, isRecycled, isVisible, isWebMapBaselayer, reinitializeLayer, setName, setOnStatusChangedListener, setOpacity, setPopupInfos, setVisible
 
Methods inherited from class java.lang.Object
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.

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.

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.

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
Method Detail

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.

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 ArcGISLayerInfo.getLayers() to get the sub-layer of the group layer.

Returns:
an array of type ArcGISLayerInfo.

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.

getLayerDefinitions

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

Returns:
Returns the layerDefs.
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.


Copyright © 2012. All Rights Reserved.