Class TLcdLASModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable,ILcdModelDecoder,ILcdStatusSource
.las) and LASzip files (.laz).
This decoder supports versions 1.0, 1.1, 1.2, 1.3 and 1.4 for the LASer format.
For the LASzip format, versions 1.0, 1.1, 1.2, 1.3 and 1.4 are supported.
Only LASzip files with points compressed into chunks of points using arithmetic encoding are supported. For more information, see the LASzip specification.
Input Files
| File | Required | Entry point | Description |
|---|---|---|---|
| *.las | X | X | The LASer file |
| *.laz | X | X | The LASzip file |
ILcdModelReferenceDecoder. The default reference decoder set on this
model decoder is based on all model reference decoders annotated with the LcdService annotation, and can handle
- EPSG references (
<filename>.epsg): seeTLcdEPSGModelReferenceDecoderfor more info. - WKT references (
<filename>.prj): seeTLcdWKTModelReferenceDecoderfor more info. - Luciad encoded model references (
<filename>.ref): seeTLcdModelReferenceDecoderfor more info.
Supported file transfer protocols
- This model decoder supports all transfer protocols that are supported by the
inputStreamFactoryof this decoder.
Model structure
- The decoded models implement
ILcdBounded(which returns the extent of the data). - The decoded models do not support spatial queries.
Model descriptor
All models returned by this model decoder have aTLcdLASModelDescriptor.
The model descriptor contains various properties available in the .las header, as well as the variable-length records.
Model reference
- All models returned by this model decoder usually have a
ILcdGridReferenceorILcdGeodeticReference. - The reference is decoded from the
.lasfile variable-length record. - If the file does not contain a reference, the model reference decoder is used.
- If the model reference decoder does not find a reference, the default model reference is used.
By default, this model decoder loads up to 1000000L points of the file, spread over the whole range of points. This way, you still see a lower-resolution version of the data that is otherwise too large to load.
You can increase or decrease the maximum number of points to load using setMaxNumberOfPoints(long).
Model reference decoder priority
A model reference decoder priority for TLcdLASModelDecoder can be set to change the order in which an ILcdModelReference is decoded by setting
the system property com.luciad.format.las.TLcdLASModelDecoder.referenceDecoderPriority to one of these priority values.
| Priority | Explanation |
|---|---|
EMBEDDED_FIRST |
The model reference decoding is first attempted from the reference information embedded in the data file (.las/.laz). If that fails, the model reference decoding is tried from external reference source files such as WKT (.prj), REF (.ref) and EPSG (*.epsg). |
EXTERNAL_FIRST |
The model reference decoding is first attempted from external reference source files such as WKT (.prj), REF (.ref) and EPSG (*.epsg). If that fails, the model reference decoding is tried from the reference information embedded in the data file (.las/.laz). |
By default, the priority is set to use EMBEDDED_FIRST.
|
|
This configuration can be useful in scenarios where the model reference embedded in the data file (.las/.laz) might be incorrect or incomplete.
You can fix it by placing an external reference file next to the data file, and setting the system property
com.luciad.format.las.TLcdLASModelDecoder.referenceDecoderPriority to EXTERNAL_FIRST.
|
|
Model elements
- The elements in the model can only be used for visualization with a
TLspLIDARLayerBuilder. - The points themselves are lazily loaded when accessed by a painter. As such, the bulk of the work is not done in the
decode()method, but later.
Updating the model
- Models are read-only and cannot be changed.
Sample code
ILcdModelDecoder decoder = new TLcdLASModelDecoder();
ILcdModel model = decoder.decode( "data.las" );
Thread safety
- Use
TLcdLockUtil#readLock(Object)when accessing elements in the model.
Supported versions
This model decoder supports:- LAS format (
.las): version 1.0, 1.1, 1.2, 1.3 and 1.4 - LASzip format (
.laz): version 1.0, 1.1, 1.2, 1.3 and 1.4
- Since:
- 2014.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new LAS model decoder with the default settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStatusListener(ILcdStatusListener aStatusListener) Registers the given listener so it will receive status events from this model decoder.booleancanDecodeSource(String aSourceName) 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 data source.Returns the default model reference that is assigned to decoded models whose files don't specify model references.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder.Returns the input stream factory that is currently used for creating input streams given source names.longReturns the maximum number of points that is kept in the model after decoding.Returns the model reference decoder that is used for files that don't specify model references.Returns the filter used to omit points during decoding.booleanReturns whether or not to perform a (fast) data scan when decoding a dataset.booleanReturns whether the geodetic datums of the decoded model references may be geoid datums.voidremoveStatusListener(ILcdStatusListener aStatusListener) Removes the specified listener so it is no longer notified.voidsetDefaultModelReference(ILcdModelReference aDefaultModelReference) Sets the default model reference to be assigned to decoded models whose files don't specify model references.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory that will be used for creating input streams given source names.voidsetMaxNumberOfPoints(long aMaxNumberOfPoints) Sets the maximum number of points kept during decoding.voidsetModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder) Sets the model reference decoder that will be used for files that don't specify model references.voidsetPerformBoundsAndRangeScan(boolean aPerformBoundsAndRangeScan) Sets whether or not to perform a (fast) data scan when decoding a dataset.voidsetPointFilter(ILcdFilter<ILcdDataObject> aPointFilter) Sets the filter used to omit points during decoding.voidsetSupportGeoidDatums(boolean aSupportGeoidDatums) Specifies whether the geodetic datums of the decoded model references may be geoid datums (like EGM96), instead of the default ellipsoid datums (like WGS84).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
-
Constructor Details
-
TLcdLASModelDecoder
public TLcdLASModelDecoder()Creates a new LAS model decoder with the default settings.
model reference decoder: a reference decoder that supports.ref,.prjand.epsgfilesdefault model reference: not set (null)support geoid datums:falseinput stream factory: aTLcdInputStreamFactorymaximum number of points: 1000000Lpoint filter: not set (null)
-
-
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 currently used for creating input streams given source names.- Specified by:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Returns:
- the input stream factory that is currently used.
-
addStatusListener
Registers the given listener so it will receive status events from this model decoder.Note that the model produced by this model decoder is lazy-loading: most of the decoding work is done when the model is accessed, not during the
decode(java.lang.String)itself.The status listeners will therefor receive the status events not only during the
decode(java.lang.String)itself, but also later when the model is accessed, after the decode has finished.You can expect the following event flow multiple times:
START_BUSYPROGRESSwith a progress values between 0 and 1END_BUSY
- Specified by:
addStatusListenerin interfaceILcdStatusSource- Parameters:
aStatusListener- The listener to be notified when the status has changed.
-
removeStatusListener
Description copied from interface:ILcdStatusSourceRemoves the specified listener so it is no longer notified.- Specified by:
removeStatusListenerin interfaceILcdStatusSource- Parameters:
aStatusListener- The listener to remove.
-
setModelReferenceDecoder
Sets the model reference decoder that will be used for files that don't specify model references.- Parameters:
aModelReferenceDecoder- the model reference decoder.
-
getModelReferenceDecoder
Returns the model reference decoder that is used for files that don't specify model references. The default value supports WKT (*.prj), REF (*.ref), and EPSG (*.epsg).- Returns:
- the model reference decoder used by this decoder
- See Also:
-
isPerformBoundsAndRangeScan
public boolean isPerformBoundsAndRangeScan()Returns whether or not to perform a (fast) data scan when decoding a dataset. This fixes incorrect bounds and allows querying the data range of every property usingTLcdLASModelDescriptor.getPropertyRange(com.luciad.datamodel.TLcdDataProperty). The default value of this property istrue.- Returns:
- aPerformBoundsAndRangeScan if true, point data is scanned when opening a dataset
- Since:
- 2018.0
-
setPerformBoundsAndRangeScan
public void setPerformBoundsAndRangeScan(boolean aPerformBoundsAndRangeScan) Sets whether or not to perform a (fast) data scan when decoding a dataset. This fixes incorrect bounds, incorrect little-endian vs. big-endian color encoding and allows querying the data range of every property usingTLcdLASModelDescriptor.getPropertyRange(com.luciad.datamodel.TLcdDataProperty). Disabling this functionality speeds up model decoding, but property ranges cannot be queried.- Parameters:
aPerformBoundsAndRangeScan- if true, point data is scanned when opening a dataset. If false, the bounds of the headers are used and no property range will be available.- Since:
- 2018.0
-
setDefaultModelReference
Sets the default model reference to be assigned to decoded models whose files don't specify model references.- Parameters:
aDefaultModelReference- the default model reference.
-
getDefaultModelReference
Returns the default model reference that is assigned to decoded models whose files don't specify model references. -
setSupportGeoidDatums
public void setSupportGeoidDatums(boolean aSupportGeoidDatums) Specifies whether the geodetic datums of the decoded model references may be geoid datums (like EGM96), instead of the default ellipsoid datums (like WGS84). A geoid typically varies 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.
trueby default.- Parameters:
aSupportGeoidDatums-trueto support geoid datums- See Also:
-
isSupportGeoidDatums
public boolean isSupportGeoidDatums()Returns whether the geodetic datums of the decoded model references may be geoid datums.- Returns:
- whether the geodetic datums of the decoded model references may be geoid datums.
- See Also:
-
getMaxNumberOfPoints
public long getMaxNumberOfPoints()Returns the maximum number of points that is kept in the model after decoding.- Returns:
- the maximum number of points that is kept in the model after decoding.
- See Also:
-
setMaxNumberOfPoints
public void setMaxNumberOfPoints(long aMaxNumberOfPoints) Sets the maximum number of points kept during decoding.
The points that are kept will be spread over the whole range of points, so that you still see a lower-resolution version of the data. See also performance note in
TLspLIDARLayerBuilder.The default is 1000000L.
Use
Long.MAX_VALUEto make sure that all points are always kept during decoding.- Parameters:
aMaxNumberOfPoints- the maximum number of points kept during decoding.- See Also:
-
getPointFilter
Returns the filter used to omit points during decoding.- Returns:
- the filter used to omit points during decoding, can be
null. - See Also:
-
setPointFilter
Sets the filter used to omit points during decoding. When this filter returns
false, the given points is not added to the decoded model. Note that implementations of this filter should not hold on to the points as they may become invalid afterwards.It is possible that points are already filtered because a max number of points is set on this model decoder. In that case, the given filter is applied on the remaining points.
- Parameters:
aPointFilter- the filter used to omit domain objects during decoding. Can benull.- See Also:
-
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:
aSourceName- the data source to be verified; typically a file name or a URL.- Returns:
trueif this decoder can likely decode the data specified by the source name,falseotherwise.- 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 data source. This method reads the bounds from the file header and does not read the points data to check if these bounds are correct.- Specified by:
decodeModelMetadatain interfaceILcdModelDecoder- Parameters:
aSourceName- the data source for which the model metadata will be decoded.- Returns:
- the model metadata for the data source, never null.
- Throws:
IOException- if the metadata cannot be decoded for some reason.- See Also:
-