VB.NET Tutorial

This basic tutorial explains how to use libLAS to read and write LIDAR data encoded in LAS file format from VB.NET.

Hello world

Imports System
Imports System.Text
Imports LibLAS
Class Program
       Private Shared Sub Main(args As String())
                       Dim lasreader As New LASReader("F:\sample_in.las")
                       Dim laspoint As LASPoint
                       Dim lasheader As LASHeader = lasreader.GetHeader()
                       Dim laswriter As New LASWriter("F:\sample_out.las", lasheader, LASReadWriteMode.LASModeWrite)
                       Console.WriteLine("Number of points in file= {0}", lasheader.PointRecordsCount)
                       While lasreader.GetNextPoint()
                               laspoint = lasreader.GetPoint()
                               'Console.WriteLine(laspoint.X + "," + laspoint.Y + "," + laspoint.Z);
                       End While
               Catch e As LASException
                       Console.WriteLine("" & Chr(10) & "LASException! Msg: {0}", e.Message)
                       Console.WriteLine("Unknown exception caught")
                       Console.WriteLine("Do i need something to do?")
               End Try
               Console.WriteLine("End of file")
       End Sub
End Class