[Liblas-devel] c tutorial needed

Riki Tiki mongoose_riki at mail.ru
Wed Oct 28 12:06:42 EDT 2009


hi,

from liblas site i found the below c# code, can anyone show me the same example but written in c? 
also can you tell me which header files should be included in c programs trying to read and write las files? thanks!


===============================================================
using System;
using System.Text;
using LibLAS;
class Program
{
   static void Main(string[] args)
   {
       try
       {
           LASReader lasreader = new LASReader(@"F:\sample_in.las");
           LASPoint laspoint;
           LASHeader lasheader = lasreader.GetHeader();
           LASWriter laswriter = 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);
               laswriter.WritePoint(laspoint);
           }
       }
       catch (LASException e)
       {
           Console.WriteLine("\nLASException! Msg: {0}", e.Message);
       }
       catch
       {
           Console.WriteLine("Unknown exception caught");
       }
       finally
       {
           Console.WriteLine("Do i need something to do?");
       }
       Console.WriteLine("End of file");
       Console.Read();
   }
}



More information about the Liblas-devel mailing list