Skip to main content

A simple Python package to read LAZ files (LAS too).

Project description

GitHub license PyPI version

simplaz

A Python package to read LAZ files (LAS too). Basically it's a wrapper around Rust las and it exposes the most useful methods.

It doesn't read in memory the whole file, so you can just iterate over each point sequentially without worrying about your RAM comsumption.

Only reading at this moment; writing is for later.

Installation

pip

To install the latest release: pip install simplaz

Development

  1. install Rust (v1.39+)
  2. install maturin
  3. maturin develop
  4. move to another folder, and import simplaz shouldn't return any error

Documentation

The pydoc can be found here.

Example

import simplaz
import numpy as np

ds = simplaz.read_file("/Users/hugo/data/ahn3/crop.laz")

header = ds.header
print("LAS v{}".format(header.version))
print("Point count: {}".format(header.number_of_points))

#-- using numpy functions
#-- define a specific numpy type
mypoint = np.dtype([('x','float64'), 
                    ('y', 'float64'), 
                    ('z', 'float64'), 
                    ('intensity', 'int16')]
                    ) 
pts = np.zeros((ds.header.number_of_points,), dtype=mypoint)

#-- iterate over all the points and store in numpy array only 
#-- the ground point (classification=2)
for (i, p) in enumerate(ds):
    if p.classification == 2:
        pts[i][0] = p.x
        pts[i][1] = p.y
        pts[i][2] = p.z
        pts[i][3] = p.classification
print (len(pts))

What is supported and what not?

Most of LAS v1.4 is supported, except:

  • v1.4 support for extra bits after each point

LAS classes

Classification description
0 Created, never classified
1 Unclassfied
2 Ground
3 Low Vegetation
4 Medium Vegetation
5 High Vegetation
6 Building
7 Low Point (noise)
8 Model Key-point (mass point)
9 Water
10 Reserved for ASPRS definition
11 Reserved for ASPRS definition
12 Overlap Points
13-31 Reserved for ASPRS definition

LAS Point format

This is well explained on this page.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for simplaz, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size simplaz-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl (239.5 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size simplaz-0.3.0-cp36-cp36m-manylinux1_x86_64.whl (282.9 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size simplaz-0.3.0-cp36-none-win_amd64.whl (242.6 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size simplaz-0.3.0-cp37-cp37m-macosx_10_7_x86_64.whl (239.3 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size simplaz-0.3.0-cp37-cp37m-manylinux1_x86_64.whl (282.6 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size simplaz-0.3.0-cp37-none-win_amd64.whl (242.4 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size simplaz-0.3.0-cp38-cp38-macosx_10_7_x86_64.whl (239.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size simplaz-0.3.0-cp38-cp38-manylinux1_x86_64.whl (282.6 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size simplaz-0.3.0-cp38-none-win_amd64.whl (242.4 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size simplaz-0.3.0.tar.gz (13.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page