public class

FileRasterSource

extends RasterSource
java.lang.Object
   ↳ com.esri.core.raster.RasterSource
     ↳ com.esri.core.raster.FileRasterSource

Class Overview

A FileRasterSource, which reads raster data directly from a raster file to be displayed or analyzed. The raster can be added to a map via a RasterLayer.

Summary

Public Constructors
FileRasterSource(String path)
Constructs a FileRasterSource based on the raster data located at the provided path.
Public Methods
void buildPyramid(int maxLevel, boolean skipFirstLevel, ResamplingProcessType pyramidResamplingType, String pyramidCompressionType)
Builds pyramids from the raster data, allowing for quicker rendering.
boolean computeStatistics(int skipX, int skipY, double[] ignoreValues)
Computes statistics on the raster data to allow other produces to be more performant, such as stretching values for stretch renderers.
boolean deleteStatistics()
Deletes previously computed statistics.
void dispose()
Disposes the FileRasterSource and releases its resources.
int getBandCount()
Gets the number of bands in the raster data.
String[] getBandNames()
Gets all of the band names.
String getCompression()
Gets the type of compression that was used to compress the raster data, or null if it is uncompressed.
Envelope getExtent()
Gets the extent that is covered by this raster, or null if the extent is unable to be determined.
String getFormat()
Gets the image format that the raster data is stored in.
int getHeight()
Gets the height of this raster (number of vertical pixels), or -1 if the width is unable to be determined.
long getId()
Gets the unique ID of the FileRasterSource
String getName()
Gets the name of the raster data
String getPath()
Gets the path to the raster data.
PixelType getPixelType()
Gets the pixel type of the raster.
int getWidth()
Gets the width of this raster (number of horizontal pixels), or -1 if the width is unable to be determined.
void project(SpatialReference spatialReference)
Projects the raster data to the specified spatial reference.
Protected Methods
void finalize()
[Expand]
Inherited Methods
From class com.esri.core.raster.RasterSource
From class java.lang.Object

Public Constructors

public FileRasterSource (String path)

Constructs a FileRasterSource based on the raster data located at the provided path. For geopackages and geodatabases, only the first table will be displayed.

Parameters
path String: the path to the raster file
Throws
IllegalArgumentException if the path is null or empty string
FileNotFoundException if file cannot be found
RuntimeException if there was an error reading the file, e.g. an unsupported format

Public Methods

public void buildPyramid (int maxLevel, boolean skipFirstLevel, ResamplingProcessType pyramidResamplingType, String pyramidCompressionType)

Builds pyramids from the raster data, allowing for quicker rendering.

Parameters
maxLevel int: the maximum number of pyramids to build
skipFirstLevel boolean: true to skip the first level
pyramidResamplingType ResamplingProcessType
pyramidCompressionType String

public boolean computeStatistics (int skipX, int skipY, double[] ignoreValues)

Computes statistics on the raster data to allow other produces to be more performant, such as stretching values for stretch renderers. The skip values will determine the gap of pixels to compute statistics on. e.g. a value of 5 would compute statistics on every 5th pixel.

Parameters
skipX int: The number of pixels to skip in each row
skipY int: The number of pixels to skip in each column
ignoreValues double: a set of values to ignore (i.e. will not be considered in statistical computation)
Returns
boolean true if the statistics were computed successfully

public boolean deleteStatistics ()

Deletes previously computed statistics. This can be used if new values for statistical computation are desired (e.g. if computeStatistics will be called with new values for skipX, skipY, or ignoreValues).

Returns
boolean true if the statistics were deleted successfully.

public void dispose ()

Disposes the FileRasterSource and releases its resources. If statistics were computed or deleted, then the appropriate file will be updated upon calling this method.

public int getBandCount ()

Gets the number of bands in the raster data.

Returns
int the number of bands in the raster data

public String[] getBandNames ()

Gets all of the band names.

Returns
String[] all of the band names;

public String getCompression ()

Gets the type of compression that was used to compress the raster data, or null if it is uncompressed.

Returns
String the type of compression used to compress the raster data

public Envelope getExtent ()

Gets the extent that is covered by this raster, or null if the extent is unable to be determined.

Returns
Envelope the extent covered by this raster

public String getFormat ()

Gets the image format that the raster data is stored in.

Returns
String the format the raster data is stored in

public int getHeight ()

Gets the height of this raster (number of vertical pixels), or -1 if the width is unable to be determined.

Returns
int the height of this raster

public long getId ()

Gets the unique ID of the FileRasterSource

Returns
long the unique ID of the FileRasterSource

public String getName ()

Gets the name of the raster data

Returns
String the name of the raster data

public String getPath ()

Gets the path to the raster data.

Returns
String the path to the raster data

public PixelType getPixelType ()

Gets the pixel type of the raster.

Returns
PixelType the pixel type of the raster

public int getWidth ()

Gets the width of this raster (number of horizontal pixels), or -1 if the width is unable to be determined.

Returns
int the width of this raster

public void project (SpatialReference spatialReference)

Projects the raster data to the specified spatial reference.

Parameters
spatialReference SpatialReference: the spatial reference to project to

Protected Methods

protected void finalize ()

Throws
Throwable