Class TLcdDEMModelDecoder

java.lang.Object
com.luciad.format.raster.TLcdDEMModelDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable, ILcdModelDecoder

@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdDEMModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
This model decoder decodes elevation rasters in the DEM format (USGS Digital Elevation Model).

Input files

File Required Entry point Description
*.dem x x DEM file containing the elevation raster

Supported file transfer protocols

  • This model decoder supports all transfer protocols that are supported by the inputStreamFactory of this decoder.

Model structure

  • This model decoder creates a model per DEM file.
  • All models returned by this model decoder implement ILcd2DBoundsIndexedModel.

Model descriptor

  • All models returned by this model decoder have a TLcdDEMModelDescriptor.
  • The type name of the model descriptor is the display name of this decoder.

Model reference

  • All models returned by this model decoder have an ILcdGeodeticReference (for geodetic systems) or an ILcdGridReference (for UTM systems) as a model reference.
  • The geodetic datum of this reference is a geoid datum NGVD27, NAVD88, or EGM96, or, if supportGeoidDatums is set tofalse, a less accurate ellipsoidal datum WGS72, WGS84, NAD27 or NAD83.

Model elements

  • Each decoded model contains one object: an ALcdImage (and ILcdRaster) instance.
  • The decoded elevation data is always point-sampled. This is however only exposed via the ALcdImage interface. Legacy rasters are assumed to be area-sampled.

Useful settings

  • The property colorModel allows to override the default 16-bits index color that is attached to the decoded rasters, since DEM files don't contain any color information.

Sample code


 TLcdDEMModelDecoder   decoder    = new TLcdDEMModelDecoder();
 ILcdColorModelFactory factory    = new TLcdDTEDColorModelFactory();
 ColorModel            colorModel = factory.createColorModel();

 decoder.setColorModel(colorModel);

 ILcdModel model = decoder.decode("elevations.dem");
 

Performance tips

  • Since DEM rasters only provide a single level of detail, precomputing and storing multiple levels of detail may speed up visualization and some computations. For instance, the TLcdGeoTIFFModelEncoder can create compressed multilevel GeoTIFF files that can replace the original DEM files.

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

  • Standards for Digital Elevation Models, US Department of the Interior, US Geological Survey, National Mapping Division, August 1997

Known limitations

  • Only geographic and UTM reference systems are supported. State plane reference systems are not supported.
  • Only the following datums are supported: horizontal datums NAD27, WGS72, WGS84, and NAD83, and vertical datums NVGD29, NAVD88, and EGM96. The following datums are not supported: old Hawaii and Puerto Rico.
  • Field Details

  • Constructor Details

    • TLcdDEMModelDecoder

      public TLcdDEMModelDecoder()
      Creates a new TLcdDEMModelDecoder, with a globally shared buffer for caching tiles.
      See Also:
    • TLcdDEMModelDecoder

      public TLcdDEMModelDecoder(ILcdBuffer aBuffer)
      Creates a new TLcdDEMModelDecoder.
      Parameters:
      aBuffer - the buffer in which decoded raster tiles will be cached.
  • Method Details

    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Sets the input stream factory that will be used for creating input streams given source names.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the input stream factory to be used.
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Returns the input stream factory that is used for creating input streams given source names.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      the input stream factory that is used.
    • setColorModel

      public void setColorModel(ColorModel aColorModel)
      Sets the color model that will be attached to decoded rasters.
      Parameters:
      aColorModel - a 16-bit IndexColorModel.
    • getColorModel

      public ColorModel getColorModel()
      Returns the color model that is attached to decoded rasters.
    • setSupportGeoidDatums

      public void setSupportGeoidDatums(boolean aSupportGeoidDatums)
      Specifies whether the geodetic datums of the decoded model references may be geoid datums (like NAVD88), instead of the ellipsoid datums (like NAD83). Geoids vary smoothly between -110m and +90m around the ellipsoid. Geoid datums are more accurate for elevation data, but they require more memory and more processing time when they are being used in transformation calculations.
    • isSupportGeoidDatums

      public boolean isSupportGeoidDatums()
      Returns whether the geodetic datums of the decoded model references may be geoid datums. Geoid support is enabled by default, unless otherwise configured by the system property com.luciad.geodesy.geoidSupport.LEGACY.
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Returns:
      the displayable name of this ILcdModelDecoder.
    • canDecodeSource

      public boolean canDecodeSource(String aString)
      Description copied from interface: ILcdModelDecoder
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return true for a source name while decode throws 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:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aString - the data source to be verified; typically a file name or a URL.
      Returns:
      true if file name aString has extension (ends with) "dem".
      See Also:
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Description copied from interface: ILcdModelDecoder
      Creates a new model from the given data source.
      Specified by:
      decode in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be decoded; typically a file name or a URL.
      Returns:
      A model containing the decoded data. While null is 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: