public final class CoverageUtilities extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CoverageUtilities.UCUM
Unified Code for Units of Measure (UCUM)
|
Modifier and Type | Field and Description |
---|---|
static double |
AFFINE_IDENTITY_EPS |
static AffineTransform |
AXES_SWAP
Axes transposition for swapping Lat and Lon axes.
|
static AffineTransform |
CENTER_TO_CORNER
AffineTransform that can be used to go from an image datum placed at the center of
pixels to one that is placed at ULC. |
static AffineTransform |
CORNER_TO_CENTER
AffineTransform that can be used to go from an image datum placed at the ULC corner
of pixels to one that is placed at center. |
static AffineTransform |
IDENTITY_TRANSFORM
Identity affine transformation.
|
static InternationalString |
NODATA
Public name for standard No Data category.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
checkEmptySourceRegion(ImageReadParam readParameters,
Rectangle dimensions)
Checks that the provided
dimensions when intersected with the source region used by
the provided ImageReadParam instance does not result in an empty Rectangle . |
static double[] |
getBackgroundValues(GridCoverage2D coverage)
Retrieves a best guess for the sample value to use for background, inspecting the categories
of the provided
GridCoverage2D . |
static CoordinateReferenceSystem |
getCRS2D(Coverage coverage)
Returns a two-dimensional CRS for the given coverage.
|
static Envelope2D |
getEnvelope2D(Coverage coverage)
Returns a two-dimensional envelope for the given coverage.
|
static CoordinateReferenceSystem |
getHorizontalCRS(Coverage coverage)
Returns a two-dimensional horizontal CRS for the given coverage.
|
static double |
getMosaicThreshold(int dataType)
Returns a suitable threshold depending on the
DataBuffer type. |
static NoDataContainer |
getNoDataProperty(GridCoverage2D coverage)
Utility method for extracting NoData property from input
GridCoverage2D . |
static double[] |
getResolution(AffineTransform gridToCRS)
Computes the resolutions for the provided "grid to world" transformation The returned
resolution array is of length of 2.
|
static ROI |
getROIProperty(GridCoverage2D coverage)
Utility method for extracting ROI property from input
GridCoverage2D . |
static int |
getVisibleBand(Object image)
Returns the visible band in the specified
RenderedImage or PropertySource . |
static boolean |
isScaleTranslate(MathTransform transform,
double EPS)
Checks if the transformation is a pure scale/translate instance (using the provided tolerance
factor)
|
static boolean |
isSimpleGridToWorldTransform(AffineTransform gridToCRS,
double EPS)
Tries to estimate if the supplied affine transform is either a scale and translate transform
or if it contains a rotations which is an integer multiple of PI/2.
|
static Properties |
loadPropertiesFromURL(URL propsURL)
Extract Properties from a specified URL
|
static void |
setNoDataProperty(Map<String,Object> properties,
Object noData)
Utility method for setting NoData to the input
Map |
static void |
setROIProperty(Map<String,Object> properties,
ROI roi)
Utility method for setting ROI to the input
Map |
static Number |
suggestNoDataValue(int dataType)
Returns a suitable no data value depending on the
DataBuffer type. |
static boolean |
uses(GridCoverage coverage,
RenderedImage image)
Returns
true if the specified grid coverage or any of its source uses the following
image. |
public static final InternationalString NODATA
public static final AffineTransform AXES_SWAP
public static final AffineTransform IDENTITY_TRANSFORM
public static final AffineTransform CENTER_TO_CORNER
AffineTransform
that can be used to go from an image datum placed at the center of
pixels to one that is placed at ULC.public static final AffineTransform CORNER_TO_CENTER
AffineTransform
that can be used to go from an image datum placed at the ULC corner
of pixels to one that is placed at center.public static final double AFFINE_IDENTITY_EPS
public static CoordinateReferenceSystem getCRS2D(Coverage coverage) throws TransformException
coverage
- The coverage for which to obtains a two-dimensional CRS.TransformException
- if the CRS can't be reduced to two dimensions.public static CoordinateReferenceSystem getHorizontalCRS(Coverage coverage) throws TransformException
coverage
- The coverage for which to obtains a two-dimensional horizontal CRS.TransformException
- if the CRS can't be reduced to two dimensions.public static Envelope2D getEnvelope2D(Coverage coverage) throws MismatchedDimensionException
coverage
- The coverage for which to obtains a two-dimensional envelope.MismatchedDimensionException
- if the envelope can't be reduced to two dimensions.public static NoDataContainer getNoDataProperty(GridCoverage2D coverage)
GridCoverage2D
.NoDataContainer
object containing input NoData definitionpublic static ROI getROIProperty(GridCoverage2D coverage)
GridCoverage2D
.ROI
objectpublic static void setNoDataProperty(Map<String,Object> properties, Object noData)
Map
properties
- Map
where the nodata will be setnoData
- May be a Range
, double[]
, double
or NoDataContainer
public static void setROIProperty(Map<String,Object> properties, ROI roi)
Map
properties
- Map
where the ROI will be setroi
- ROI
instance to setpublic static double[] getBackgroundValues(GridCoverage2D coverage)
GridCoverage2D
.coverage
- to use for guessing background values.public static boolean uses(GridCoverage coverage, RenderedImage image)
true
if the specified grid coverage or any of its source uses the following
image.public static int getVisibleBand(Object image)
RenderedImage
or PropertySource
.
This method fetch the "GC_VisibleBand"
property. If this property is undefined, then
the visible band default to the first one.image
- The image for which to fetch the visible band, or null
.public static boolean isScaleTranslate(MathTransform transform, double EPS)
transform
- The MathTransform
to check.EPS
- The tolerance factor.true
if the provided transformation is a simple scale and translate, false
otherwise.public static double[] getResolution(AffineTransform gridToCRS)
gridToCRS
- The grid to world transformation.public static boolean isSimpleGridToWorldTransform(AffineTransform gridToCRS, double EPS)
gridToCRS
- an instance of AffineTransform
to check against.EPS
- tolerance value for comparisons.true
if this transform is "simple", false
otherwise.public static boolean checkEmptySourceRegion(ImageReadParam readParameters, Rectangle dimensions)
dimensions
when intersected with the source region used by
the provided ImageReadParam
instance does not result in an empty Rectangle
.
Finally, in case the region intersection is not empty, set it as new source region for the
provided ImageReadParam
.
Input parameters cannot be null.
readParameters
- an instance of ImageReadParam
for which we want to check the
source region element.dimensions
- an instance of Rectangle
to use for the check.true
if the intersection is not empty, false
otherwise.public static double getMosaicThreshold(int dataType)
DataBuffer
type.
Remember that the threshold works with >=.
dataType
- to create a low threshold for.public static Number suggestNoDataValue(int dataType)
DataBuffer
type.dataType
- to create a low threshold for.public static Properties loadPropertiesFromURL(URL propsURL)
Copyright © 1996–2023 Geotools. All rights reserved.