API / geotoolkit / welllog / data / las / Las20Stream / Las20Stream
las.Las20Stream.Las20Stream
This class implements a LAS 2.0 parser using a stream paradigm.<br> <br> This parser implements an API similar to Las20 for convenience.<br> Therefore it will provide las sections and las section group like a regular LASParser.<br> <br> However this stream parser has to be 'opened' to trigger the loading of the stream and the parsing of the sections.<br> When opening the stream, only the header sections will be loaded and parsed (Version, Well, Curve, Parameter, Other).<br> The data section won't be loaded nor parsed by default.<br> <br> As a result, 'bulk' access to the data using (for example) 'group.getCurveData' will not work.<br> However the LasStreamDataSection provides new ways of accessing the data like getDataInRange(startDepth, endDepth).<br> <br> Note that, as the LAS 2.0 format has no index, this parser will index it on the fly.<br> As a consequence, initial getDataInRange calls on a this parser may take longer than subsequent ones.<br> <br> Also, to access the data in a not stream based way, it can be forced to read its content fully during the open().<br> This is discouraged as the purpose of the LasStreamParser is to avoid loading the whole LAS data in memory (to prevent memory issues for large datasets).<br> If opened in this 'full load' mode, the 'bulk' access to the data will work.<br> <br> See the documentation of the open() function for more details.
↳
Las20Stream
Constructors
- [new Las20Stream(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.welllog.data-4.las.las20stream.las20stream.md#new las20stream(options))
Methods
▸ getClassName(): string
string
▸ getSectionGroups(): LasSectionGroup[]
Gets all the section groups. Doesn't include sections not in groups.
array of LasSectionGroup
▸ getSections(): LasParameterSection[]
Returns all sections not part of a group
array of LasSection
▸ open(fullload, success?, error?): Promise<Las20Stream>
Opens the LAS 2.0 stream and parse its headers.<br> <br> The stream can also be opened in 'legacy mode' in order to be accessed like a non-stream based parser.<br> However this is discouraged as it can lead to memory issues for huge dataset.<br> <br> Once this stream has been opened, its 'header' sections can be accessed using getSections().<br> See example for accessing the data in either 'legacy/non-stream' mode or 'stream' mode.<br> <br> Note that, for convenience, this function returns a Promise AND accepts callbacks (that do not contribute to the returned promise).<br> One is free to use either the Promise or the callback to be 'notified' when the stream is ready.<br>
Example
import {Las20Stream} from '@int/geotoolkit/las/Las20Stream';
import {BrowserFileStream} from '@int/geotoolkit/util/stream/BrowserFileStream';
import {LineReader} from '@int/geotoolkit/util/stream/LineReader';
new Las20Stream({
'reader': new LineReader({
'stream': new BrowserFileStream({
'file': file
})
})
})
.open(true)
.then((stream) => {
// load table
}).catch((e) => {
// error
});| Name | Type | Description |
|---|---|---|
fullload | boolean | If true, the stream will be fully read and parsed during its opening. (This is discouraged) |
Optional success | Callback | A function called when the headers have been parsed and the stream is ready |
Optional error | Callback | A function called if the header parsing failed |
Promise<Las20Stream>
A promise fulfilled when the headers have been parsed and the stream is ready
▸ Static getClassName(): string
string
▸ Static isLAS20(reader, success?, error?): Promise<{ details: string ; isLAS20: boolean }>
Tests if the given reader looks like a LAS 2.0<br> Note that a success does not mean that the given reader is a LAS 2.0 but only that the type has been detected.<br> To find out if it is a LAS 2.0, one should look at the result given in the promise/callback.<br> {isLAS20:true, details:"Mode information about the isLAS20 result"}<br> <br> Note that, for convenience, this function returns a Promise AND accepts callbacks (that do not contribute to the returned promise).<br> One is free to use either the Promise or the callback to be 'notified' when the stream is ready.<br> <br>
Example
Las20Stream.isLAS20(lineReader).then( (result) => {
if (result['isLAS20'] === true) {
// Can be parsed using Las20Stream
} else {
// Can't be parsed using Las20Stream
}
}).catch((e) => {
// Can't be parsed using Las20Stream
});| Name | Type | Description |
|---|---|---|
reader | LineReader | The reader to test |
Optional success | Callback | A function called when the nature of the given reader has been detected |
Optional error | Callback | A function called if a major error occurs |
Promise<{ details: string ; isLAS20: boolean }>
A promise fulfilled when the nature of the given reader has been detected