Skip to content

evetion/LazIO.jl

Repository files navigation

Build Status Build status codecov

LazIO

Extends LasIO with LASzip integration.

Uses the LASzip shared library to read compressed las files (*.laz) into the uncompressed format that LasIO reads natively.

julia> using LazIO

# Load header and all points
julia> LazIO.load("test/libLAS_1.2.laz")
(LasHeader with 497536 points.
, Vector{LasIO.LasPoint0} with 497536 points.
)

# Load header and range of points
julia> h, p = LazIO.load("test/libLAS_1.2.laz", range=2:10)
(LasHeader with 497536 points.
, Vector{LasIO.LasPoint0} with 9 points.
)

# Open file and iterate over points (streaming)
julia> ds = LazIO.open("test/libLAS_1.2.laz")
LazDataset of test/libLAS_1.2.laz with 497536 points.

julia> sum = map(Int32, (0,0,0))  # Int32, not yet scaled and offset
julia> for p in ds
           global sum = sum .+ (p.X, p.Y, p.Z)
       end
julia> sum ./ ds.header.number_of_point_records
(3497.988658107152, 3741.789882541163, -164.49942114741447)

# Or use the tables interface
julia> using DataFrames
julia> DataFrame(ds)
497536×19 DataFrame. Omitted printing of 12 columns
│ Row    │ X         │ Y        │ Z     │ intensity │ return_number
│        │ Int32     │ Int32    │ Int32 │ UInt16    │ UInt8
├────────┼───────────┼──────────┼───────┼───────────┼──────────────
│ 114401339437500023846660x00fa0x00214401242637500049846550x00f50x00314401144737500077846440x00ef0x00414401046937500104846320x00fb0x00