mreutegg / laszip4j

The LASzip library ported to Java
GNU Lesser General Public License v2.1
36 stars 16 forks source link
java lastools laszip lidar

laszip4j

Maven Central Quality Gate Status Build Status

The LASzip library ported to Java

This is a Java port of the LASzip and LAStools libraries by Martin Isenburg (RIP).

The port to Java is not complete. Many classes are stubs only and have not been ported. The main driver was to have a Java implementation of the laszip utility and be able to unpack LAZ files for Canton of Zurich in Switzerland, which works fine.

Usage is the same as with the native laszip utility, but invoked as a runnable jar:

java -jar laszip4j-0.18.jar -oparse xyzc -keep_class 3 4 5 6 10 -i 7015_2640.laz -o 7015_2640.xyzk

On top of LASzip and LAStools this library also provides convenience classes for reading LAS points. You can read LAS points in your code like this:

    LASReader reader = new LASReader(new File("data.laz"));
    for (LASPoint p : reader.getPoints()) {
        // read something from point
        p.getClassification();
    }

See also LASReaderTest on how to use the LASReader class.

As of version 0.13, laszip4j also supports writing las files. In the simplest case the executable jar file can be used to read compressed data from a laz file and write it to a corresponding las file.

java -jar laszip4j-0.18.jar -i 7015_2640.laz -o 7015_2640.las