GithubHelp home page GithubHelp logo

visr / liblas.jl Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 4.5 MB

Julia wrapper for LibLAS, a library for reading and writing the LAS LiDAR format.

License: Other

Julia 100.00%
julia lidar las laz point-cloud io

liblas.jl's Introduction

LibLAS

Julia wrapper for LibLAS, a library for reading and writing the LAS LiDAR format.

Note: Like LibLAS itself, this project is currently in hibernation or maintenance mode. For reading and writing LAS files in pure Julia, have a look at LasIO.jl.

Build Status

Install

pkg> add https://github.com/visr/LibLAS.jl

You need to have the liblas_c shared library in your path, this is currently not added to the package. See the LibLAS website for how to obtain it.

Use

using LibLAS

# testfile downloaded from http://www.liblas.org/samples/
filename = joinpath(dirname(pathof(LibLAS)), "..", "test", "libLAS_1.2.las")

reader = LibLAS.create(LibLAS.LASReader, filename)
header = LibLAS.lasheader(reader)

n = LibLAS.pointrecordscount(header)

bounds = [LibLAS.min_x(header), LibLAS.min_y(header), LibLAS.min_z(header),
          LibLAS.max_x(header), LibLAS.max_y(header), LibLAS.max_z(header)]

function mean_coordinates(header, reader)
    n = LibLAS.pointrecordscount(header)
    x_sum = 0.0
    y_sum = 0.0
    z_sum = 0.0

    # looping over all points
    for i = 1:n
        p = LibLAS.nextpoint(reader)
        x = LibLAS.xcoord(p)
        y = LibLAS.ycoord(p)
        z = LibLAS.zcoord(p)

        x_sum += x
        y_sum += y
        z_sum += z
    end

    x_avg = x_sum / n
    y_avg = y_sum / n
    z_avg = z_sum / n
    x_avg, y_avg, z_avg
end

x_avg, y_avg, z_avg = mean_coordinates(header, reader)

# jumping to a specific point
p = LibLAS.point_at(reader, 101)
intens = LibLAS.intensity(p)

For more documentation on specific functions see the LibLAS C API reference. Function names are adapted to follow Julian naming conventions. They have not all been tested. Please open an issue/PR if you find any mistakes.

liblas.jl's People

Contributors

visr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.