@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdETOPOModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
File | Required | Entry point | Description |
---|---|---|---|
etopo1_ice_c_i2.bin etopo1_bed_c_i2.bin |
x | x | Global Gridded 1-minute Database |
ETOPO2v2c_i2_MSB.bin ETOPO2v2_MSB.raw ETOPO2.raw.bin |
x | x | Global Gridded 2-minute Database |
ETOPO5.DAT | x | Global Gridded 5-minute Database |
inputStreamFactory
of this decoder.Apply geoid datums
: This setting will cause the decoder to return
a model with the ellipsoid as vertical datum, but the returned data will have the geoid offsets incorporated. In
other words, elevations are returned as above ellipsoid, but have been corrected with the geoid offset.Support geoid datums
: This setting will cause the decoder to return
a model with the EGM-96 geoid model as vertical datum. Elevation data is returned as above mean sea level.ILcd2DBoundsIndexedModel
.TLcdETOPOModelDescriptor
.ALcdImage
(and ILcdRaster
) instance.ALcdImage
interface. Legacy rasters are assumed to
be area-sampled.colorModel
allows to override the default
16-bits index color that is attached to the decoded rasters, since
ETOPO files don't contain any color information.
TLcdETOPOModelDecoder decoder = new TLcdETOPOModelDecoder();
ILcdColorModelFactory factory = new TLcdDTEDColorModelFactory();
ColorModel colorModel = factory.createColorModel();
decoder.setColorModel(colorModel);
ILcdModel model = decoder.decode("etopo1_ice_c_i2.bin");
TLcdGeoTIFFModelEncoder
can
create compressed multilevel GeoTIFF files that can replace the original
ETOPO files.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DISPLAY_NAME
The display name of this decoder.
|
static String |
ETOPO1_BED_C_NAME
The ETOPO1 cell-registered (with bedrock surface underneath ice) file name.
|
static String |
ETOPO1_BED_G_NAME
The ETOPO1 grid-registered (with bedrock surface underneath ice) file name.
|
static String |
ETOPO1_ICE_C_NAME
The ETOPO1 cell-registered (with ice surface) file name.
|
static String |
ETOPO1_ICE_G_NAME
The ETOPO1 grid-registered (with ice surface) file name.
|
static String |
ETOPO2_NAME
The ETOPO2 file name.
|
static String |
ETOPO2v2_NAME
The ETOPO2 version 2 (MSB) file name.
|
static String |
ETOPO2v2c_NAME
The ETOPO2 version 2 (cell-registered, MSB) file name.
|
static String |
ETOPO2v2g_NAME
The ETOPO2 version 2 (grid-registered, MSB) file name.
|
static String |
ETOPO5_NAME
The ETOPO5 file name.
|
Constructor and Description |
---|
TLcdETOPOModelDecoder()
Creates a new TLcdETOPOModelDecoder with a globally shared buffer for
caching tiles.
|
TLcdETOPOModelDecoder(ILcdBuffer aBuffer)
Creates a new TLcdETOPOModelDecoder with the given shared buffer.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
ColorModel |
getColorModel()
Returns the color model that is attached to decoded rasters.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is used for creating input streams
given source names.
|
boolean |
isApplyGeoidDatums()
Determines if geoid datum correction is applied during decoding or not.
|
boolean |
isSupportGeoidDatums()
Determines if geoid datum is supported or not.
|
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.
|
void |
setColorModel(ColorModel aColorModel)
Sets the color model that is attached to decoded rasters.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams
given source names.
|
void |
setSupportGeoidDatums(boolean aSupportGeoidDatums)
Specifies whether the decoded geodetic datum of the geodetic reference
should be a geoid datum (EGM96), instead of the default ellipsoid datum
(WGS84).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final String DEFAULT_DISPLAY_NAME
public static final String ETOPO1_ICE_C_NAME
public static final String ETOPO1_BED_C_NAME
public static final String ETOPO1_ICE_G_NAME
public static final String ETOPO1_BED_G_NAME
public static final String ETOPO2v2c_NAME
public static final String ETOPO2v2g_NAME
public static final String ETOPO2v2_NAME
public static final String ETOPO2_NAME
public static final String ETOPO5_NAME
public TLcdETOPOModelDecoder()
TLcdSharedBuffer.getBufferInstance()
public TLcdETOPOModelDecoder(ILcdBuffer aBuffer)
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public void setColorModel(ColorModel aColorModel)
aColorModel
- a 16-bit IndexColorModel.public ColorModel getColorModel()
public void setSupportGeoidDatums(boolean aSupportGeoidDatums)
More information on elevation handling can be found in the geoid section of the class documentation
public boolean isSupportGeoidDatums()
setSupportGeoidDatums(boolean)
public void setApplyGeoidDatums(boolean aApplyGeoidDatums)
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.
More information on elevation handling can be found in the geoid section of the class documentation
public boolean isApplyGeoidDatums()
setApplyGeoidDatums(boolean)
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aSourceName)
ILcdModelDecoder
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.
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the data source to be verified; typically a file name or a URL.true
if the given source name is
"etopo1_ice_c_i2.bin",
"etopo1_bed_c_i2.bin",
"ETOPO2v2c_i2_MSB.bin",
"ETOPO2v2_MSB.raw",
"ETOPO2.raw.bin", or
"ETOPO5.DAT".ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.null
is allowed, implementors are advised to throw an error instead.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);
}
}
InterruptedIOException
- When the thread on which this method is called is interrupted: it is recommended to stop the decoding
and throw an InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.ILcdModelDecoder.canDecodeSource(String)