[Liblas-devel] c tutorial needed

Howard Butler hobu.inc at gmail.com
Wed Oct 28 12:29:51 EDT 2009


The best C API tutorials are the utilities, as they are almost all  
written in C.

<http://liblas.org/browser/apps/las2las.c>

<http://liblas.org/browser/apps/lascommon.c>

These two probably provide the most coverage the C API. Otherwise the  
place to look is the liblas.h header, which while it does not have any  
examples, is very complete <http://liblas.org/doxygen/a00033.html>

HTH,

Howard





On Oct 28, 2009, at 11:06 AM, Riki Tiki wrote:

>
> 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();
>   }
> }
>
> _______________________________________________
> Liblas-devel mailing list
> Liblas-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/liblas-devel



More information about the Liblas-devel mailing list