Class for reading LAS files.
More...
|
IList< LasMessage > | GetMessages () |
| Return messages related to the previous LAS file read operation.
|
|
| LasFileReader (FileInfo file, string characterEncoding="ISO-8859-1") |
| Create a LAS file reader for the specified disk file.
|
|
| LasFileReader (Stream inputStream, string characterEncoding="ISO-8859-1") |
| Create a LAS file reader for the specified stream.
|
|
|
static string | GuessEncoding (FileInfo file) |
| Guess text encoding of the specified file.
|
|
static double | IsLasFile (FileInfo file, byte[] content=null) |
| Check if the specified file appears to be a LAS file.
|
|
Class for reading LAS files.
Typical usage:
LasFileReader reader = new LasFileReader(new FileInfo("/path/to/file.LAS"));
IList<LasFile> lasFiles = reader.Read();
The method always returns a list of LasFile instances in case the disk file contains multiple logical files in sequence.
This class supports all versions of the LAS format.
- See also
- LAS 3.0 Specification
- Author
- Petroware AS
◆ LasFileReader() [1/2]
LasFileReader |
( |
Stream | inputStream, |
|
|
string | characterEncoding = "ISO-8859-1" ) |
Create a LAS file reader for the specified stream.
- Parameters
-
inputStream | Stream to read. Non-null. |
characterEncoding | Character encoding to use during file read. Typically "UTF-8", "US_ASCII" or "ISO-8859-1". Non-null. Defaults to "ISO-8859-1". |
- Exceptions
-
ArgumentNullException | If inputStream or characterEncoding is null. |
ArgumentException | If characterEncoding is invalid. |
◆ LasFileReader() [2/2]
LasFileReader |
( |
FileInfo | file, |
|
|
string | characterEncoding = "ISO-8859-1" ) |
Create a LAS file reader for the specified disk file.
- Parameters
-
file | Disk file to read. Non-null. |
characterEncoding | Character encoding to use during file read. Typically "UTF-8", "US-ASCII" or "ISO-8859-1". Non-null. Defaults to "ISO-8859-1". |
- Exceptions
-
ArgumentNullException | If file or characterEncoding is null. |
ArgumentException | If characterEncoding is invalid. |
◆ GetMessages()
Return messages related to the previous LAS file read operation.
- Returns
- List of messages associated with the read operation. Never null.
◆ GuessEncoding()
static string GuessEncoding |
( |
FileInfo | file | ) |
|
|
static |
Guess text encoding of the specified file.
LAS files are supposed to be encoded as US-ASCII (7 bit ASCII), but are commonly encoded differently to accomodate for meta-data using language specific characters. Such meta-data will end up wrong (typically containing replacement characters often rendered as "?" in output) if read by the standard encoding.
This method will distingusih between US-ASCII, UTF8 or 8-bit ASCII (ISO 8859-1) and does not detect more esoteric encodings like UTF16 etc.
- Parameters
-
file | File to check. Non-null. |
- Returns
- The most probable encoding of the file. Returns "ISO 8859-1" if not specifically detected as US_ASCII or UTF8. Never null.
- Exceptions
-
ArgumentNullException | If file is null. |
◆ IsLasFile()
static double IsLasFile |
( |
FileInfo | file, |
|
|
byte[] | content = null ) |
|
static |
Check if the specified file appears to be a LAS file.
The check can be done with or without considering the content of the file. In the latter case, only the file name (typically its extension) is considered. In the former case a portion from the start of the file is used to match for known patterns. By passing the portion as an argument, the client code can read this once and then pass it to different classifiers in order to determine its most likely type.
Getting a portion of a file can be done by:
FileInfo file = ...;
BinaryReader reader = new BinaryReader(file.OpenRead());
byte[] content = new byte[2000]; //say
reader.Read(content, 0, content.Length);
reader.Close();
- Parameters
-
file | File to check. Null to classify on content only. |
content | A number of bytes from the start of the file. Null to classify on file name only. |
- Returns
- Probability that the file is a LAS file. [0.0,1.0].
The documentation for this class was generated from the following file:
- Petroware/LogIo/Las/LasFileReader.cs