public final class RasterModelHeightProvider extends Object implements AutoCloseable
This class is thread-safe.
Related article: Retrieving height data.
Modifier and Type | Class and Description |
---|---|
static class |
RasterModelHeightProvider.Builder
Builder for a RasterModelHeightProvider . |
Constructor and Description |
---|
RasterModelHeightProvider(RasterModelHeightProvider other) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
CoordinateReference |
getReference() |
boolean |
isInterpolate() |
static RasterModelHeightProvider.Builder |
newBuilder()
Returns a new
RasterModelHeightProvider builder. |
Double |
retrieveHeightAt(Coordinate coordinate,
double pixelDensity)
Retrieve the height data at the provided point at a provided pixel density.
|
Double |
retrieveHeightAt(Coordinate coordinate,
PixelDensity pixelDensity)
Retrieve the height data at the provided point at a provided pixel density.
|
void |
setInterpolate(boolean interpolate)
Set whether (bilinear) interpolation should be used when converting the source elevation data to a height value.
|
public RasterModelHeightProvider(@NotNull RasterModelHeightProvider other)
public void close()
close
in interface AutoCloseable
@NotNull public static RasterModelHeightProvider.Builder newBuilder()
RasterModelHeightProvider
builder.RasterModelHeightProvider
builder.@Nullable public Double retrieveHeightAt(@NotNull Coordinate coordinate, @NotNull PixelDensity pixelDensity)
Looks for a tile in the underlying raster data covering the specified point and with a pixel density equal or lower to the specified density, and returns elevation data based on that tile. If several tiles match, then the most detailed tile is used; if all tiles covering the point have a density higher than requested density, then the least detailed tile is used.
coordinate
- The point for which the height is requested, expressed in the coordinate reference
of the height provider. If the height provider reference is a 2D reference, Z-value is ignored.pixelDensity
- The pixel density used to determine the level of detail to use in the underlying data. Must be in the coordinate reference
of the height provider.null
if no data is available for this coordinate.@Nullable public Double retrieveHeightAt(@NotNull Coordinate coordinate, double pixelDensity)
Looks for a tile in the underlying raster data covering the specified point and with a pixel density equal or lower to the specified density, and returns elevation data based on that tile. If several tiles match, then the most detailed tile is used; if all tiles covering the point have a density higher than requested density, then the least detailed tile is used.
coordinate
- The point for which the height is requested, expressed in the coordinate reference
of the height provider. If the height provider reference is a 2D reference, Z-value is ignored.pixelDensity
- The pixel density used to determine the level of detail to use in the underlying data. Assumed to be in the coordinate reference
of the height provider.null
if no data is available for this coordinate.@NotNull public CoordinateReference getReference()
retrieveHeightAt
are all expressed in this reference.public boolean isInterpolate()
public void setInterpolate(boolean interpolate)
Using interpolation makes sure that neighbouring height values form a smoother curve.
interpolate
- linear interpolation is used if true, nearest neighbor if false.