- All Implemented Interfaces:
TimeAware
,LayerContent
,Loadable
In its simplest form, raster data consists of a matrix of cells (or pixels) organized into rows and columns (or a grid) where each cell contains a value representing information. Raster layer can support these main types of raster data sources:
- Raster files - path to a file on the device.
- Remote ArcGIS Image services, see
ImageServiceRaster
. - Raster files within GeoPackages, see
GeoPackageRaster
. - Mosaic datasets, see
MosaicDatasetRaster
.
RasterRenderer
and applying it to the layer.
Each raster layer supports identify on its individual cells when it is displayed in a MapView
or
SceneView
. The raster layer adopts the loadable pattern; many of its properties are initialized
asynchronously. See Loadable
for more information.
If a raster dataset has just one value associated with each cell it is called a single-band raster. For example, in a digital elevation model (DEM) each cell contains one value representing the elevation at that location.
A satellite image, however, commonly has multiple bands representing different wavelengths of the electromagnetic spectrum. Landsat imagery, for example, contains seven bands that represent data from the visible and infrared parts of the spectrum. Rasters are particularly useful for remote sensing tasks, such as monitoring vegetation and seeing through smoke to analyze an active fire.
Raster datasets can be quite large. The size of the dataset depends on the following:
- The geographic extent of the data.
- The size of the cells used (resolution).
- The number of bands.
Example for working with a Raster Layer
Raster raster = new Raster("absolute-file-path-of-raster"); RasterLayer rasterLayer = new RasterLayer(raster); rasterLayer.addDoneLoadingListener(() -> { if (rasterLayer.getLoadStatus() == LoadStatus.LOADED) { // raster layer has loaded } }); ArcGISMap map = new ArcGISMap(); map.getOperationalLayers().add(rasterLayer); mapView = new MapView(); mapView.setMap(map);The layer is loaded when displayed in a
MapView
; if using the layer without a MapView
, call the
Layer.loadAsync()
method. Use the layer done loading event to determine when the layer is ready, and
check the loaded status before using the layer.- Since:
- 100.0.0
- See Also:
-
Property Summary
Properties inherited from class com.esri.arcgisruntime.layers.Layer
loadError, loadStatus
-
Constructor Summary
ConstructorDescriptionRasterLayer
(PortalItem portalItem) Creates a raster layer from the specified image service portal item.RasterLayer
(Raster raster) Creates a raster layer from the specified raster data source. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener that will fire when there is a change to the full time extent.copy()
Creates a deep copy of this RasterLayer instance.Returns the full time extent of the object.Returns the raster data source for this layer.Gets the raster renderer used for this layer.Returns the suggested time slider step size for this time aware object.Returns the time offset applied to this object.boolean
Returns whether or not the object must use the time extent defined on the owning GeoView to filter its data.boolean
Returns whether or not the object supports filtering its contents by time values with the extent set on the owning GeoView.boolean
Removes a full time extent changed listener.void
setIsTimeFilteringEnabled
(boolean enabled) Enables or disables whether the object must use the time extent defined on the owning GeoView to filter its data.void
setRasterRenderer
(RasterRenderer rasterRenderer) Sets the raster renderer used for this layer.void
setTimeOffset
(TimeValue timeOffset) Sets a time offset for this object.Methods inherited from class com.esri.arcgisruntime.layers.ImageAdjustmentLayer
getBrightness, getContrast, getGamma, setBrightness, setContrast, setGamma
Methods inherited from class com.esri.arcgisruntime.layers.Layer
addDoneLoadingListener, addLoadStatusChangedListener, addVisibilityChangedListener, cancelLoad, canChangeVisibility, canShowInLegend, fetchLegendInfosAsync, getAttribution, getDescription, getFullExtent, getId, getItem, getLoadError, getLoadStatus, getMaxScale, getMinScale, getName, getOpacity, getSpatialReference, getSubLayerContents, isIdentifyEnabled, isVisible, isVisibleAtScale, loadAsync, loadErrorProperty, loadStatusProperty, removeDoneLoadingListener, removeLoadStatusChangedListener, removeVisibilityChangedListener, retryLoadAsync, setCanShowInLegend, setDescription, setId, setMaxScale, setMinScale, setName, setOpacity, setVisible
-
Constructor Details
-
RasterLayer
Creates a raster layer from the specified raster data source.- Parameters:
raster
- raster data source- Throws:
IllegalArgumentException
- if raster is null- Since:
- 100.0.0
-
RasterLayer
Creates a raster layer from the specified image service portal item.- Parameters:
portalItem
- a portal item of typePortalItem.Type.IMAGE_SERVICE
.- Throws:
IllegalArgumentException
- if portalItem is null- Since:
- 100.2.0
-
-
Method Details
-
getRaster
Returns the raster data source for this layer.- Returns:
- the raster used by this raster layer
- Since:
- 100.0.0
-
setRasterRenderer
Sets the raster renderer used for this layer.- Parameters:
rasterRenderer
- the rasterRenderer to set- Throws:
IllegalArgumentException
- if rasterRenderer is null- Since:
- 100.0.0
-
copy
Creates a deep copy of this RasterLayer instance.- Returns:
- a deep copy of this RasterLayer instance, which means that copies of all fields of this layer are made including its loading state
- Since:
- 100.1.0
-
getRasterRenderer
Gets the raster renderer used for this layer.- Returns:
- the raster renderer
- Since:
- 100.0.0
-
getFullTimeExtent
Description copied from interface:TimeAware
Returns the full time extent of the object. Will be null if the object is not time aware.- Specified by:
getFullTimeExtent
in interfaceTimeAware
- Returns:
- the time extent, or null if the object is not time aware
-
getTimeInterval
Description copied from interface:TimeAware
Returns the suggested time slider step size for this time aware object. Can be null if no time interval is suggested for this time aware object.- Specified by:
getTimeInterval
in interfaceTimeAware
- Returns:
- the time interval, or null if there is no time interval
-
getTimeOffset
Description copied from interface:TimeAware
Returns the time offset applied to this object. The offset is subtracted from the time extent set on the owningGeoView
. This allows for data from different periods of time to be compared.- Specified by:
getTimeOffset
in interfaceTimeAware
- Returns:
- the time offset, or null if no offset has been set
-
isTimeFilteringEnabled
public boolean isTimeFilteringEnabled()Description copied from interface:TimeAware
Returns whether or not the object must use the time extent defined on the owning GeoView to filter its data.- Specified by:
isTimeFilteringEnabled
in interfaceTimeAware
- Returns:
- true if time filtering is enabled; otherwise false
-
setIsTimeFilteringEnabled
public void setIsTimeFilteringEnabled(boolean enabled) Description copied from interface:TimeAware
Enables or disables whether the object must use the time extent defined on the owning GeoView to filter its data.- Specified by:
setIsTimeFilteringEnabled
in interfaceTimeAware
- Parameters:
enabled
- true to enable time filtering; otherwise false
-
isTimeFilteringSupported
public boolean isTimeFilteringSupported()Description copied from interface:TimeAware
Returns whether or not the object supports filtering its contents by time values with the extent set on the owning GeoView.- Specified by:
isTimeFilteringSupported
in interfaceTimeAware
- Returns:
- true if time filtering is supported; otherwise false
-
setTimeOffset
Description copied from interface:TimeAware
Sets a time offset for this object. The time offset is subtracted from the time extent set on the owningGeoView
. This allows for data from different periods of time to be compared. Can be null if there is no time offset.- Specified by:
setTimeOffset
in interfaceTimeAware
- Parameters:
timeOffset
- the time offset, or null if there is no time offset
-
addFullTimeExtentChangedListener
Description copied from interface:TimeAware
Adds a listener that will fire when there is a change to the full time extent.- Specified by:
addFullTimeExtentChangedListener
in interfaceTimeAware
- Parameters:
listener
- the listener to add
-
removeFullTimeExtentChangedListener
Description copied from interface:TimeAware
Removes a full time extent changed listener.- Specified by:
removeFullTimeExtentChangedListener
in interfaceTimeAware
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was removed, otherwise false
-