Package com.luciad.format.raster
Class TLcdDTEDModelDecoder
java.lang.Object
com.luciad.format.raster.TLcdDTEDModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable,ILcdModelDecoder
@LcdService(service=ILcdModelDecoder.class,
priority=20000)
public class TLcdDTEDModelDecoder
extends Object
implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
This model decoder decodes individual DTED (Digital Terrain Elevation Data)
files.
Input files
| File | Required | Entry point | Description |
|---|---|---|---|
| *.dt[012] | x | x | DTED file corresponding to a single cell of 1 degree by 1 degree |
Supported file transfer protocols
- This model decoder supports all transfer protocols that are supported by
the
inputStreamFactoryof this decoder.
Model structure
- This model decoder creates a model per DTED file.
- All models returned by this model decoder implement
ILcd2DBoundsIndexedModel.
Model descriptor
- All models returned by this model decoder have a
TLcdDTEDModelDescriptor. - The type name of the model descriptor is the display name of this decoder.
Model reference
- All models returned by this model decoder have instances of
ILcdGeodeticReferenceas model references. - The geodetic datum of this reference is geoid datum EGM96.
if
supportGeoidDatumsis set tofalse, a less accurate ellipsoidal datum WGS72 or WGS84 will be used.
Model elements
- Each decoded model contains one object: an
ALcdImage(andILcdRaster) instance. - The
ILcdRasterinstance in turn contains a singleTLcdDTEDTileinstance that corresponds to the DTED cell and that points to additional information about the cell. - The decoded elevation data is always point-sampled. This is however only
exposed via the
ALcdImageinterface. Legacy rasters are assumed to be area-sampled.
Useful settings
- The property
colorModelallows to override the default 16-bits index color that is attached to the decoded rasters, since DTED files don't contain any color information. - The decoded raster contains the elevation values from the corresponding
DTED cell. By default, the rasters contain tiles with piece-wise
constant pixel values, without any interpolation (sometimes referred
to as "Pixel-is-Area"). However, the original DTED cells contain
discrete sample points (sometimes referred to as "Pixel-is-Point").
The way in which a tile value is derived from the DTED can be specified
by means of the
sampleStrategyproperty. For instance, a tile value can be a corner value, or the minimum, maximum, or average of the four corner values. Furthermore, the raster values can be derived by means of bilinear interpolation. This yields better-looking results, at a higher computational cost.
Sample code
TLcdDTEDModelDecoder decoder = new TLcdDTEDModelDecoder();
ILcdModel model = decoder.decode("dted/e011/n45.dt0");
Performance tips
- It is more efficient to use a single large (multilevel)
DMED/DTED raster decoded with
TLcdDMEDModelDecoderorTLcdDTEDDirectoryModelDecoderthan to use several individual DTED rasters decoded with this decoder.
Thread safety
- The decoding of models is thread-safe, as long as no properties are changed during the decoding.
- The decoded models and elements are thread-safe for read access, on the condition that a thread-safe buffer is used.
Supported versions and specifications
- MIL-D-89020B, Digital Terrain Elevation Data (DTED), NIMA, 23 May 2000
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe sampling strategy that returns the average value of the corners of each DTED sample cell.static final intThe sampling strategy that returns a bilinear interpolation of the values of the corners of each DTED sample cell.static final Stringstatic final String[]static final intThe sampling strategy that returns the maximum value of the corners of each DTED sample cell.static final intThe sampling strategy that returns the minimum value of the corners of each DTED sample cell.static final intThe sampling strategy that returns the North-East corner of each DTED sample cell.static final intThe sampling strategy that returns the North-West corner of each DTED sample cell.static final Stringstatic final intThe sampling strategy that returns the South-East corner of each DTED sample cell.static final intThe sampling strategy that returns the South-West corner of each DTED sample cell. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a model decoder to decode DTED files, with a globally shared buffer for caching tiles.TLcdDTEDModelDecoder(ILcdBuffer aBuffer) Creates a model decoder to decode DTED files.TLcdDTEDModelDecoder(ILcdBuffer aBuffer, boolean aShading) Creates a model decoder to decode DTED files, optionally producing shaded rasters instead of elevation rasters. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(String aString) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.decodeModelMetadata(String aSourceName) Decodes metadata for the specified DTED file.Returns the color model that is attached to decoded rasters.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder.Returns the input stream factory that is used for creating input streams given source names.intbooleanbooleanReturns whether the geodetic datums of the model references may be geoid datums.voidsetApplyGeoidDatums(boolean aApplyGeoidDatums) Specifies whether the geoid heights of the geodetic datum (EGM96) should be added to the elevation data right away while decoding.voidsetColorModel(ColorModel aColorModel) Sets the color model that will be attached to decoded rasters.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory that will be used for creating input streams given source names.voidsetSampleStrategy(int aSampleStrategy) Sets the sampling strategy for retrieving elevation values.voidsetSupportGeoidDatums(boolean aSupportGeoidDatums) Specifies whether the decoded geodetic datum of the geodetic reference should be a geoid datum (EGM96), or an ellipsoid datum (WGS84 or WGS72).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
DEFAULT_DISPLAY_NAME
- See Also:
-
SHADING_DISPLAY_NAME
- See Also:
-
DEFAULT_EXTENSIONS
-
NORTH_WEST_CORNER
public static final int NORTH_WEST_CORNERThe sampling strategy that returns the North-West corner of each DTED sample cell.- See Also:
-
SOUTH_WEST_CORNER
public static final int SOUTH_WEST_CORNERThe sampling strategy that returns the South-West corner of each DTED sample cell.- See Also:
-
NORTH_EAST_CORNER
public static final int NORTH_EAST_CORNERThe sampling strategy that returns the North-East corner of each DTED sample cell.- See Also:
-
SOUTH_EAST_CORNER
public static final int SOUTH_EAST_CORNERThe sampling strategy that returns the South-East corner of each DTED sample cell.- See Also:
-
MINIMUM
public static final int MINIMUMThe sampling strategy that returns the minimum value of the corners of each DTED sample cell.- See Also:
-
MAXIMUM
public static final int MAXIMUMThe sampling strategy that returns the maximum value of the corners of each DTED sample cell.- See Also:
-
AVERAGE
public static final int AVERAGEThe sampling strategy that returns the average value of the corners of each DTED sample cell.- See Also:
-
BILINEAR
public static final int BILINEARThe sampling strategy that returns a bilinear interpolation of the values of the corners of each DTED sample cell.- See Also:
-
-
Constructor Details
-
TLcdDTEDModelDecoder
public TLcdDTEDModelDecoder()Creates a model decoder to decode DTED files, with a globally shared buffer for caching tiles.- See Also:
-
TLcdDTEDModelDecoder
Creates a model decoder to decode DTED files.- Parameters:
aBuffer- the buffer in which decoded raster tiles are cached.
-
TLcdDTEDModelDecoder
Creates a model decoder to decode DTED files, optionally producing shaded rasters instead of elevation rasters.- Parameters:
aBuffer- the buffer in which decoded raster tiles are cached.aShading- specifies whether rasters should be shaded.
-
-
Method Details
-
setInputStreamFactory
Sets the input stream factory that will be used for creating input streams given source names.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Parameters:
aInputStreamFactory- the input stream factory to be used.
-
getInputStreamFactory
Returns the input stream factory that is used for creating input streams given source names.- Specified by:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Returns:
- the input stream factory that is used.
-
setColorModel
Sets the color model that will be attached to decoded rasters.- Parameters:
aColorModel- a 16-bit IndexColorModel.
-
getColorModel
Returns the color model that is attached to decoded rasters. -
setSampleStrategy
public void setSampleStrategy(int aSampleStrategy) Sets the sampling strategy for retrieving elevation values. This setting is only relevant when accessing the DTED model via theILcdRasterAPI. TheALcdImageAPI explicitly models DTED data as being point-sampled and will ignore this setting.- Parameters:
aSampleStrategy- one ofNORTH_WEST_CORNER,SOUTH_WEST_CORNER,NORTH_EAST_CORNER,SOUTH_EAST_CORNER,MINIMUM,MAXIMUM,AVERAGE, orBILINEAR.
-
getSampleStrategy
public int getSampleStrategy() -
setSupportGeoidDatums
public void setSupportGeoidDatums(boolean aSupportGeoidDatums) Specifies whether the decoded geodetic datum of the geodetic reference should be a geoid datum (EGM96), or an ellipsoid datum (WGS84 or WGS72). The geoid varies smoothly between -110m and +90m around the ellipsoid. The geoid datum is more accurate, but it requires more memory and more processing time when it is being used in transformation calculations.The default value is
true. -
isSupportGeoidDatums
public boolean isSupportGeoidDatums()Returns whether the geodetic datums of the model references may be geoid datums.The default value is
true. -
setApplyGeoidDatums
public void setApplyGeoidDatums(boolean aApplyGeoidDatums) Specifies whether the geoid heights of the geodetic datum (EGM96) should be added to the elevation data right away while decoding. The geoid varies smoothly between -110m and +90m around the ellipsoid. The geodetic datum of the geodetic reference will then be an ordinary ellipsoid datum (WGS84 or WGS72). Decoded rasters will be more accurate, but the operation requires more memory and more processing time while decoding the elevation data (which is still done lazily).This is an alternative to
setSupportGeoidDatums(boolean). It has precedence if both options are set.Note that the 0m elevation (sea level) becomes the geoid height, which may be confusing when a raster is displayed with an elevation color model that assigns blue colors to negative elevations.
The default is
false. -
isApplyGeoidDatums
public boolean isApplyGeoidDatums() -
getDisplayName
Description copied from interface:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- the displayable name of this
ILcdModelDecoder.
-
canDecodeSource
Description copied from interface:ILcdModelDecoderChecks whether this model decoder can decode the specified data source. It is acceptable for this method to returntruefor a source name whiledecodethrows an exception for that same source name.For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.
- Specified by:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aString- the data source to be verified; typically a file name or a URL.- Returns:
trueif file name aString has extension "dt0", "dt1", "dt2", "dted", "avg", "min", or "max".- See Also:
-
decode
Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.- Specified by:
decodein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
nullis allowed, implementors are advised to throw an error instead. - Throws:
IOException- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.public ILcdModel decode( String aSourceName ) throws IOException { try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }- See Also:
-
decodeModelMetadata
Decodes metadata for the specified DTED file. If the DTED file follows the standard DTED naming conventions, this method does not do any I/O, as all metadata can be extracted from the file's source name alone. If that is not the case, this method will attempt to read the file header in order to retrieve its metadata.- Specified by:
decodeModelMetadatain interfaceILcdModelDecoder- Parameters:
aSourceName- the DTED file for which metadata will be decoded.- Returns:
- the model metadata for the given DTED file.
- Throws:
IOException- if the metadata cannot be decoded for some reason.- See Also:
-