Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jblindsay/lidario
A small Go library for reading and writing LiDAR (LAS) files
https://github.com/jblindsay/lidario
gis gis-data las lidar
Last synced: about 2 months ago
JSON representation
A small Go library for reading and writing LiDAR (LAS) files
- Host: GitHub
- URL: https://github.com/jblindsay/lidario
- Owner: jblindsay
- License: mit
- Created: 2017-04-02T18:15:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-04T19:58:35.000Z (about 3 years ago)
- Last Synced: 2024-04-20T09:05:31.288Z (3 months ago)
- Topics: gis, gis-data, las, lidar
- Language: Go
- Homepage:
- Size: 86.8 MB
- Stars: 24
- Watchers: 6
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-gis - lidario - A small Go library for reading and writing LiDAR (LAS) files. (Geospatial Library / Go)
- awesome-point-cloud-processing - **lidadrio** - lidario is a simple library for reading and writing LiDAR files stored in LAS format. The library is written using the Go programing language. (Software (Open Source))
- awesome-gis - lidario - A small Go library for reading and writing LiDAR (LAS) files. (Geospatial Library / Go)
- Awesome-Geospatial - lidario - A small Go library for reading and writing LiDAR (LAS) files. (Go)
README
lidario
=======Description
-----------lidario is a simple library for reading and writing LiDAR files stored in LAS format. The library is written using the Go programing language. Use the *build.py* file to build/install the source code. The script can also be used to run the tests.
Example Usage
--------------```Go
import "github.com/jblindsay/lidario"func main() {
// Reading a LAS file
fileName := "testdata/sample.las"
var lf *lidario.LasFile
var err error
lf, err = lidario.NewLasFile(fileName, "r")
if err != nil {
fmt.Println(err)
}
defer lf.Close()// Print the data contained in the LAS Header
fmt.Printf("%v\n", lf.Header)// Print the VLR data
fmt.Println("VLRs:")
for _, vlr := range lf.VlrData {
fmt.Println(vlr)
}// Get the X,Y,Z data for a single point
x, y, z, err := lf.GetXYZ(1000)
fmt.Printf("Point %v: (%f, %f, %f) Error: %v\n", j, x, y, z, err)
// Get an entire point, including all parts
var p lidario.LasPointer
p, err = lf.LasPoint(1000)
if err != nil {
fmt.Println(err)
t.Fatal()
}
fmt.Println("Point format:", p.Format())// Read all the points
oldProgress := -1
progress := 0
for i := 0; i < int(lf.Header.NumberPoints); i++ {
if p, err := lf.LasPoint(i); err != nil {
fmt.Println(err)
t.Fatal()
} else {
if i < 10 {
pd := p.PointData()
fmt.Printf("Point %v: (%f, %f, %f, %v, %v, %f)\n", i, pd.X, pd.Y, pd.X, pd.Intensity, pd.ClassBitField.ClassificationString(), p.GpsTimeData())
}
progress = int(100.0 * float64(i) / float64(lf.Header.NumberPoints))
if progress != oldProgress {
oldProgress = progress
if progress%10 == 0 {
fmt.Printf("Progress: %v\n", progress)
}
}
}
}// Create a new LAS file
newFileName := "testdata/newFile.las"
newLf, err := lidario.InitializeUsingFile(newFileName, lf)
if err != nil {
fmt.Println(err)
t.Fail()
}
defer newLf.Close()progress = 0
oldProgress = -1
for i := 0; i < int(lf.Header.NumberPoints); i++ {
if p, err := lf.LasPoint(i); err != nil {
fmt.Println(err)
t.Fatal()
} else {
if p.PointData().Z < 100.0 { // only output the point if the elevation is less than 100.0 m
newLf.AddLasPoint(p)
}
}
progress = int(100.0 * float64(i) / float64(lf.Header.NumberPoints))
if progress != oldProgress {
oldProgress = progress
if progress%10 == 0 {
fmt.Printf("Progress: %v\n", progress)
}
}
}
}
```