- All Implemented Interfaces:
LayerContent
,Loadable
- Direct Known Subclasses:
AnnotationLayer
,ArcGISSceneLayer
,ArcGISVectorTiledLayer
,DimensionLayer
,DynamicEntityLayer
,EncLayer
,FeatureCollectionLayer
,FeatureLayer
,GroupLayer
,ImageAdjustmentLayer
,IntegratedMeshLayer
,KmlLayer
,MobileBasemapLayer
,Ogc3DTilesLayer
,PointCloudLayer
,UnknownLayer
,UnsupportedLayer
A layer, also known as an operational layer, provides access to geographic data that is displayed in a map or
scene. Each layer references a file or service data source that contains either vector data (points, lines,
polygons and attributes) or raster data (images). The ArcGISMap
or ArcGISScene
can display these layers inside a
MapView
or SceneView
, respectively. To enhance the displayed information, you can 'stack' the layers
into a collection of GeoModel.getOperationalLayers()
or GeoModel.getOperationalLayers()
. The first layer in the collection
is drawn first (on the bottom) and each subsequent layer is drawn on top of it.
Layer is the base class for these different types of layers:
Layer type | 2D/3D | Time-aware | Online/offline | Sources |
---|---|---|---|---|
Annotation layer (AnnotationLayer ) |
2D | No | Both | ArcGIS feature service, portal item, mobile map package (.mmpk) |
ArcGIS map image layer (ArcGISMapImageLayer ) |
Both | Yes | Online | ArcGIS map service |
ArcGIS scene layer (ArcGISSceneLayer ) |
3D | No | Both | Scene service or scene package |
ArcGIS tiled layer (ArcGISTiledLayer ) |
Both | No | Both | ArcGIS tile service, tile package (.tpk/.tpkx) |
ArcGIS vector tiled layer (ArcGISVectorTiledLayer ) |
Both | No | Both | ArcGIS vector tile service, vector tile package (.vtpk) |
Bing maps layer (BingMapsLayer ) |
Both | No | Online | Bing maps |
Dimension layer (DimensionLayer ) |
2D | Yes | Offline | Mobile map package (.mmpk) |
Dynamic entity layer (DynamicEntityLayer ) |
Both | No | Online | ArcGIS stream service |
ENC layer (EncLayer ) |
2D | No | Offline | ENC exchange set, ENC cell |
Feature collection layer (FeatureCollectionLayer ) |
Both | No | Both | Portal item, web map, feature set / query result |
Feature layer (FeatureLayer ) |
Both | Yes | Both | ArcGIS feature service, WFS, shapefile, GeoPackage, geodatabase, OGC API Features |
Group layer (GroupLayer ) |
Both | No | Both | Other layers and group layers |
KML layer (KmlLayer ) |
Both | Yes | Both | KML file (.kml, .kmz) |
Integrated mesh layer (IntegratedMeshLayer ) |
3D | No | Both | Scene layer package (.slpk) |
Mobile basemap layer (MobileBasemapLayer ) |
2D | No | Offline | Mobile map package (.mmpk) |
OGC 3D Tiles layer (Ogc3DTilesLayer ) |
3D | No | Both | Portal item, tileset, tile package(.3tz) |
OpenStreetMap layer (OpenStreetMapLayer ) |
Both | No | Online | OpenStreetMap.org |
Point cloud layer (PointCloudLayer ) |
3D | No | Both | Portal item, scene layer package (.slpk) |
Raster layer (RasterLayer ) |
Both | Yes | Both | GeoPackage, raster file, ArcGIS Image service |
Subtype feature layer (SubtypeFeatureLayer ) |
2D | No | Both | ArcGIS feature service, geodatabase |
Web tiled layer (WebTiledLayer ) |
Both | No | Online | Web tile service |
WMS layer (WmsLayer ) |
Both | Yes | Online | WMS service |
WMTS layer (WmtsLayer ) |
Both | No | Online | WMTS service |
- Since:
- 100.0.0
-
Property Summary
TypePropertyDescriptionThe load error.The load status. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDoneLoadingListener
(Runnable listener) Adds a listener to the loadable resource that is invoked when loading has completed.void
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.void
Adds a visibility changed listener to the layer.void
Cancels loading metadata for the object.boolean
Checks whether we can change the visibility of this layer.boolean
Checks if this layer will be listed in the legend.Asynchronously fetches a list of legend information for this layer, if any.Gets the attribution for this layer, such as data providers or copyright text.Gets the description of this layer.Gets the full extent of this layer, which is the extent where all layer data is contained.getId()
Gets the unique identifying string for the layer, as specified in a map or scene.getItem()
Gets the Item associated with this layer.Gets the value of theloadError
property.Gets the value of theloadStatus
property.double
Gets the maximum zoom scale for this layer.double
Gets the minimum zoom scale for this layer.getName()
Gets the name of this layer.float
Gets the opacity of this layer.Gets the spatial reference of this layer.Returns a list of sub layers, if any.boolean
True if the layer supports identify, false otherwise.boolean
Checks if this layer is visible or not.boolean
isVisibleAtScale
(double scale) Checks if this layer has effective visibility at the given scale.void
Loads the metadata of the loadable resource asynchronously.The load error.The load status.boolean
removeDoneLoadingListener
(Runnable listener) Removes a done loading listener from the loadable resource.boolean
Removes aLoadStatusChangedListener
from the loadable resource.void
Removes the visibility changed listener from the layer.void
Loads or retries loading metadata for the object asynchronously.void
setCanShowInLegend
(boolean canShowInLegend) Sets whether or not this layer should be visible in the legend.void
setDescription
(String description) Sets the description of this layer.void
Sets the unique identifying string for the layer, as specified in a map or scene.void
setMaxScale
(double maxScale) Sets the maximum zoom scale for this layer.void
setMinScale
(double minScale) Sets the minimum zoom scale for this layer.void
Sets the name of this layer.void
setOpacity
(float opacity) Sets the opacity of this layer.void
setVisible
(boolean visible) Sets the layer's visibility ifLayerContent.canChangeVisibility()
returns true.
-
Property Details
-
loadStatus
- Specified by:
loadStatusProperty
in interfaceLoadable
- See Also:
-
loadError
- Specified by:
loadErrorProperty
in interfaceLoadable
- See Also:
-
-
Method Details
-
getAttribution
Gets the attribution for this layer, such as data providers or copyright text.- Returns:
- the attribution for this layer
- Since:
- 100.0.0
-
getDescription
Gets the description of this layer.- Returns:
- the description of this layer
- Since:
- 100.0.0
-
setDescription
Sets the description of this layer.- Parameters:
description
- the description to set on this layer- Since:
- 100.0.0
-
getFullExtent
Gets the full extent of this layer, which is the extent where all layer data is contained.You can use this to zoom to all of the data contained in this layer. For feature layers, the extent is retrieved from its
FeatureTable.getExtent()
.- Returns:
- the full extent of this layer
- Since:
- 100.0.0
- See Also:
-
getId
Gets the unique identifying string for the layer, as specified in a map or scene.The id is used by other parts of this API to refer to a specific Layer, such as in a set of
FeatureFenceParameters
or aFacilityLayerDefinition
. If not supplied, all layers will be assigned a unique id when created.- Returns:
- the unique identifying string for the layer, as specified in a map or scene
- Since:
- 100.0.0
- See Also:
-
setId
Sets the unique identifying string for the layer, as specified in a map or scene.The id is used by other parts of this API to refer to a specific Layer, such as in a set of
FeatureFenceParameters
or aFacilityLayerDefinition
. If not supplied, all layers will be assigned a unique id when created.It is not recommended to change this property when the layer is obtained from a map or scene. If changed, ensure that the string is unique, for example based on a generated GUID.
- Parameters:
id
- the unique identifying string for the layer, for example specified in a map or scene- Throws:
IllegalArgumentException
- if id is null- Since:
- 100.0.0
-
getMaxScale
public double getMaxScale()Gets the maximum zoom scale for this layer. This determines the maximum scale level this layer can zoom to.The maximum scale at which this layer is visible. If the map or scene is zoomed in beyond this scale, the layer will not be visible. A value of 0 means there is no maximum scale threshold and the layer will be visible at the smallest scale available for the map or scene. All of the connected map and scene views will be updated.
- Returns:
- the maximum scale level this layer can zoom to
- Since:
- 100.0.0
-
setMaxScale
public void setMaxScale(double maxScale) Sets the maximum zoom scale for this layer. This controls the maximum scale level this layer can zoom to.The maximum scale at which this layer is visible. If the map or scene is zoomed in beyond this scale, the layer will not be visible. A value of 0 means there is no maximum scale threshold and the layer will be visible at the smallest scale available for the map or scene. All of the connected map and scene views will be updated.
- Parameters:
maxScale
- the maximum scale level this layer can zoom to- Since:
- 100.0.0
-
getMinScale
public double getMinScale()Gets the minimum zoom scale for this layer. This determines the minimum scale level this layer can zoom to.The minimum scale at which this layer is visible. If the map or scene is zoomed out beyond this scale, the layer will not be visible. A value of 0 means there is no minimum scale threshold and the layer will be visible at the largest scale available for the map or scene. If the value is nil, there is no minimum scale. All of the connected map and scene views will be updated.
- Returns:
- the minimum scale level this layer can zoom to
- Since:
- 100.0.0
-
setMinScale
public void setMinScale(double minScale) Sets the minimum zoom scale for this layer. This controls the minimum scale level this layer can zoom to.The minimum scale at which this layer is visible. If the map or scene is zoomed out beyond this scale, the layer will not be visible. A value of 0 means there is no minimum scale threshold and the layer will be visible at the largest scale available for the map or scene. If the value is nil, there is no minimum scale. All of the connected map and scene views will be updated.
- Parameters:
minScale
- the minimum scale level this layer can zoom to- Since:
- 100.0.0
-
getName
Gets the name of this layer.- Specified by:
getName
in interfaceLayerContent
- Returns:
- the name of this layer
- Since:
- 100.0.0
-
setName
Sets the name of this layer.- Parameters:
name
- the name of this layer- Since:
- 100.0.0
-
getOpacity
public float getOpacity()Gets the opacity of this layer.The opacity of this layer as a value between 0 (fully transparent) and 1 (fully opaque). The default opacity value is 1.
- Returns:
- The opacity of this layer, which is a value in the range of 0.0 - 1.0, with the default being 1.0 which is fully opaque.
- Since:
- 100.0.0
-
setOpacity
public void setOpacity(float opacity) Sets the opacity of this layer.The opacity of this layer as a value between 0 (fully transparent) and 1 (fully opaque). The default opacity value is 1.
- Parameters:
opacity
- the opacity of this layer, which needs to be a value in the range of 0.0 - 1.0, 1.0 being fully opaque- Since:
- 100.0.0
-
getItem
Gets the Item associated with this layer.- Returns:
- the associated Item or null if this layer is not associated with an Item
- Since:
- 100.0.0
-
getSpatialReference
Gets the spatial reference of this layer.- Returns:
- the spatial reference of this layer
- Since:
- 100.0.0
-
isIdentifyEnabled
public boolean isIdentifyEnabled()True if the layer supports identify, false otherwise.The value of this property may not be correct until the layer is in a fully loaded state.
- Returns:
- true if the layer supports identify, false otherwise
- Since:
- 100.2.0
-
addVisibilityChangedListener
Adds a visibility changed listener to the layer.- Parameters:
listener
- the visibility changed listener to add- Throws:
IllegalArgumentException
- if the listener is null- Since:
- 100.9.0
-
removeVisibilityChangedListener
Removes the visibility changed listener from the layer.- Parameters:
listener
- the visibility changed listener to be removed- Since:
- 100.9.0
-
canChangeVisibility
public boolean canChangeVisibility()Description copied from interface:LayerContent
Checks whether we can change the visibility of this layer.- Specified by:
canChangeVisibility
in interfaceLayerContent
- Returns:
- true if we can change this layer's visibility; false otherwise
-
isVisible
public boolean isVisible()Description copied from interface:LayerContent
Checks if this layer is visible or not.- Specified by:
isVisible
in interfaceLayerContent
- Returns:
- true if the layer is visible; false otherwise
- See Also:
-
setVisible
public void setVisible(boolean visible) Description copied from interface:LayerContent
Sets the layer's visibility ifLayerContent.canChangeVisibility()
returns true.- Specified by:
setVisible
in interfaceLayerContent
- Parameters:
visible
- true to make the layer visible; false to hide it- See Also:
-
isVisibleAtScale
public boolean isVisibleAtScale(double scale) Description copied from interface:LayerContent
Checks if this layer has effective visibility at the given scale. This effective visibility takes care of the effective visibility of the parents at the specified scale.- Specified by:
isVisibleAtScale
in interfaceLayerContent
- Parameters:
scale
- the scale the visibility has to be calculated for- Returns:
- true if the layer will be visible at the given scale; false otherwise
-
canShowInLegend
public boolean canShowInLegend()Description copied from interface:LayerContent
Checks if this layer will be listed in the legend.- Specified by:
canShowInLegend
in interfaceLayerContent
- Returns:
- true if this layer will be visible in the legend; false otherwise
-
setCanShowInLegend
public void setCanShowInLegend(boolean canShowInLegend) Description copied from interface:LayerContent
Sets whether or not this layer should be visible in the legend.- Specified by:
setCanShowInLegend
in interfaceLayerContent
- Parameters:
canShowInLegend
- true to show in the legend; false to omit it from the legend
-
getSubLayerContents
Description copied from interface:LayerContent
Returns a list of sub layers, if any. If there are no sub-layers, an empty list will be returned. This list cannot be used to add or remove sub-layers.- Specified by:
getSubLayerContents
in interfaceLayerContent
- Returns:
- a read only list of sub-layers, if any
-
fetchLegendInfosAsync
Description copied from interface:LayerContent
Asynchronously fetches a list of legend information for this layer, if any.- Specified by:
fetchLegendInfosAsync
in interfaceLayerContent
- Returns:
- a listenable future that can be used to get the legend information. Null is returned if an error occurs.
-
getLoadStatus
Gets the value of theloadStatus
property.- Specified by:
getLoadStatus
in interfaceLoadable
- Property description:
- Returns:
- the value of the
loadStatus
property - See Also:
-
getLoadError
Gets the value of theloadError
property.- Specified by:
getLoadError
in interfaceLoadable
- Property description:
- Returns:
- the value of the
loadError
property - See Also:
-
loadAsync
public void loadAsync()Description copied from interface:Loadable
Loads the metadata of the loadable resource asynchronously.The load status changes from
LoadStatus.NOT_LOADED
toLoadStatus.LOADING
. A listener can be added viaLoadable.addDoneLoadingListener(java.lang.Runnable)
that is invoked upon completion of the asynchronous load operation.If the load operation completes successfully, the load status will be
LoadStatus.LOADED
, which means the resource has loaded its metadata.If the load operation failed, the load status will be
LoadStatus.FAILED_TO_LOAD
and the error can be retrieved by callingLoadable.getLoadError()
.This method can be called concurrently and repeatedly, but only one attempt is ever made to perform the load operation. If a load operation is already in progress (
LoadStatus.LOADING
state) whenloadAsync
is called, it simply piggy-backs on the outstanding operation and the done loading listener added to the loadable resource is enqueued to be invoked when that operation completes. If the operation has already completed (LoadStatus.LOADED
orLoadStatus.FAILED_TO_LOAD
state) whenloadAsync
is called, the done loading listener is immediately invoked when added to the loadable resource.If a loadable resource has failed to load, calling
loadAsync
on it subsequently will not change its state. The done loading listener will be invoked immediately when added to the loadable resource. In order to retry loading the resource,Loadable.retryLoadAsync()
needs to be used.A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by callingLoadable.cancelLoad()
. -
retryLoadAsync
public void retryLoadAsync()Description copied from interface:Loadable
Loads or retries loading metadata for the object asynchronously.Will retry loading the metadata if the object's load status is
LoadStatus.FAILED_TO_LOAD
. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.For more details on the load process see
Loadable.loadAsync()
.- Specified by:
retryLoadAsync
in interfaceLoadable
-
cancelLoad
public void cancelLoad()Description copied from interface:Loadable
Cancels loading metadata for the object.Cancels loading the metadata if the object is loading, and always invokes the done loading listener.
A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADING
toLoadStatus.FAILED_TO_LOAD
state. If the load operation was successfully cancelled, a CancellationException will be returned fromLoadable.getLoadError()
.Cancellation should be used carefully because all enqueued done loading listeners for that resource instance will get invoked with an error stating that the operation was cancelled. Thus, one component in the application can cancel the load operation initiated by other components.
This method does nothing if the resource is not in
LoadStatus.LOADING
state.- Specified by:
cancelLoad
in interfaceLoadable
-
addDoneLoadingListener
Description copied from interface:Loadable
Adds a listener to the loadable resource that is invoked when loading has completed.The listener may be added at any point, whether the loadable resource has already completed loading or not.
- For resources that are not loaded when the listener is added (LoadStatus is NOT_LOADED or LOADING): When the resource completes loading, the listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- For resources that are already loaded when the listener is added (LoadStatus is LOADED or FAILED_TO_LOAD): The listener will be called immediately, on the current thread.
Alternatively, to be notified when there is any change in the load status, add a listener to the
Loadable.loadStatusProperty()
instead.- Specified by:
addDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- a Runnable that is invoked upon completion of the load operation
-
removeDoneLoadingListener
Description copied from interface:Loadable
Removes a done loading listener from the loadable resource.- Specified by:
removeDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- the listener to be removed- Returns:
- true if the listener was removed, otherwise false
-
addLoadStatusChangedListener
Description copied from interface:Loadable
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
The listener will not be called if added to a loadable resource that has already completed loading. To be notified when a loadable resource has completed loading, including if the resource is already loaded when the listener is added, use the
Loadable.addDoneLoadingListener(Runnable)
method.- Specified by:
addLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be added
-
removeLoadStatusChangedListener
Description copied from interface:Loadable
Removes aLoadStatusChangedListener
from the loadable resource.- Specified by:
removeLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be removed- Returns:
- true if the listener was removed, otherwise false
-
loadStatusProperty
Description copied from interface:Loadable
The load status.- Specified by:
loadStatusProperty
in interfaceLoadable
- Returns:
- the
loadStatus
property - See Also:
-
loadErrorProperty
Description copied from interface:Loadable
The load error.- Specified by:
loadErrorProperty
in interfaceLoadable
- Returns:
- the
loadError
property - See Also:
-