lidar
Version, currently master branch1 version
- master branchlatestFeb 26, 2017
github.com/jblindsay/lidar
A Crystal language library for reading and writing LiDAR data in LAS format
6 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
lidar:
github: jblindsay/lidar
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- John Lindsay
Dependencies
This version declares no dependencies.
README
lidar
This is a small library for reading and writing LiDAR data in the widely used LAS file format. The library has been developed as an experiment to learn the Crystal programming language.
Installation
Add this to your application's shard.yml:
dependencies:
lidar:
github: jblindsay/lidar
Usage
require "lidar"
file_name = "path/to/file/test.las"
# Create a new LasFile instance for reading based on the file_name
lf = Lidar::LasFile.new file_name, "r"
# Print the meta data contained in the LAS header
puts("#{lf}")
# Now print the variable length records (VLRs)
if lf.header.number_of_vlrs > 0
(0...lf.header.number_of_vlrs).each { |i|
puts "VLR #{i + 1}:"
puts("#{lf.vlr_data[i]}")
}
end
# Print the first 10 points of the LAS data
(0...10).each do |i|
puts("Point #{i + 1} #{lf.get_xyzi_data(i)}")
end
# Create a new LAS file to write data into
file_name2 = "path/to/file/test2.las"
lf2 = Lidar::LasFile.new file_name2, "w"
# Add the header
lf2.add_header(lf.header)
# Add the VLRs to the file
lf.vlr_data.each do |vlr|
lf2.add_vlr(vlr)
end
# Add the point data to the file that lies within a specified area
north = 4363700.0
south = 4363200.0
east = 659400.0
west = 658900.0
(0...lf.header.number_of_points).each do |i|
p = lf[i]
if (west <= p.point.x <= east) && (south <= p.point.y <= north)
lf2.add_point_record(lf[i])
end
end
# Write the data
lf2.write
Contributing
- Fork it ( https://github.com/jblindsay/lidar/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- jblindsay John Lindsay - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Feb 26, 2017
- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/jblindsay/lidar
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1