public final class PixelDensity extends Object implements AutoCloseable
Concretely it's a value with the following units: px² / uom². Here, 'uom' mean the unit of measure of the coordinate reference in which the pixel density is expressed. It is typically meters.
More information on this, and hints on its usages can be fount in the related article: Retrieving height data.
A typical way to create a pixel density is by converting it from a sample distance. Imagine for example that you want to sample elevation data along a line, and get an elevation value every meter. In that case, you can use the fromSampleDistance
method to create a pixel density where the distance between every pixel corresponds to 1 meter.
Constructor and Description |
---|
PixelDensity(CoordinateReference reference,
double value)
Construct a PixelDensity object.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
static PixelDensity |
fromSampleDistance(double distanceInMeters,
Coordinate sampleLocation,
CoordinateReference pixelDensityReference)
Creates a pixel density from a sample distance.
|
CoordinateReference |
getReference() |
double |
getValue() |
public PixelDensity(@NotNull CoordinateReference reference, double value)
reference
- the coordinate reference, cannot be null
value
- the density value expressed in the given coordinate reference, must be greater than 0public void close()
close
in interface AutoCloseable
public double getValue()
@NotNull public CoordinateReference getReference()
@NotNull public static PixelDensity fromSampleDistance(double distanceInMeters, @NotNull Coordinate sampleLocation, @NotNull CoordinateReference pixelDensityReference) throws IllegalArgumentException
The resulting PixelDensity, expressed in the given coordinate reference, is such that the distance between pixels corresponds roughly with the provided distance in meters at the given location.
distanceInMeters
- the desired distance between two adjacent samples, in meterssampleLocation
- the point at which the distance between samples must be equal to distanceInMeterspixelDensityReference
- the reference in which sampleLocation, and the resulting PixelDensity, is expressedIllegalArgumentException
- if pixelDensityReference is neither a grid nor a geodetic reference.