[pdal] Write and zip function based on PDAL

Michael P. Gerlek mpg at flaxen.com
Wed Oct 5 12:56:32 EDT 2011


If you look at the example code (TestLasReader.cs) off the latest git, you'll see I have code that does exactly what you want - it extracts out the X,Y,Z fields and then (un)scales them appropriately.

 

[Note too that the latest version of pdal doesn't use SchemaLayouts anymore.]

 

-mpg

 

 

From: ping yang [mailto:pingyang.whu at gmail.com] 
Sent: Tuesday, October 04, 2011 7:53 PM
To: mpg at flaxen.com
Cc: pdal at lists.osgeo.org
Subject: Re: [pdal] Write and zip function based on PDAL

 

Hi Mike,

 

I have some questions on how to get the X,Y,Z value from the PDAL, I saw last time you sent me code like this:

 

Schema schema = reader.getSchema();

SchemaLayout layout = new SchemaLayout(schema);

PointBuffer data = new PointBuffer(layout, 128);

// get the dimensions (fields) of the point record for the X, Y, and Z values

int offsetX = schema.getDimensionIndex(Dimension.Field.Field_X, Dimension.DataType.Int32);

int offsetY = schema.getDimensionIndex(Dimension.Field.Field_Y, Dimension.DataType.Int32);

int offsetZ = schema.getDimensionIndex(Dimension.Field.Field_Z, Dimension.DataType.Int32);

Dimension dimensionX = schema.getDimension((uint)offsetX);

Dimension dimensionY = schema.getDimension((uint)offsetY);

Dimension dimensionZ = schema.getDimension((uint)offsetZ);


You were using the Dimension, would you please let me know how can I get the X,Y,Z value of each point?

Is there a LasPoint structure in the PDAL?

 Is the PointBuffer can be used for loading all the points into memory at one time?



On Thu, Sep 8, 2011 at 5:28 PM, Michael P. Gerlek <mpg at flaxen.com> wrote:

Ping:

Grab these two updated DLLs:

 http://dl.dropbox.com/u/17690616/pdal_swig_cpp.dll
 http://dl.dropbox.com/u/17690616/pdal_swig_cs.dll

and then the below program should work fine.  If you need a more complex
workflow, just let us know and we'll talk you through it.

-mpg






       private void Test1()
       {
           Console.WriteLine("Starting LasWriter test1");

           {
               // create the reader
               Options readerOpts = new Options();
               Option readerOpt1 = new Option();

readerOpt1.setValue_String("../../test/data/1.2-with-color.las");
               readerOpt1.setName("filename");

               readerOpts.add(readerOpt1);
               LasReader reader = new LasReader(readerOpts);

               Options writerOpts = new Options();
               Option writerOpt1 = new Option();
               writerOpt1.setValue_String("foo.laz");
               writerOpt1.setName("filename");
               writerOpts.add(writerOpt1);
               LasWriter writer = new LasWriter(reader, writerOpts);
               writer.initialize();

               writer.setCompressed(true);
               writer.setDate(0, 0);
               writer.setPointFormat(PointFormat.PointFormat3);
               writer.setSystemIdentifier("");
               writer.setGeneratingSoftware("TerraScan");

               // how many points do we have?
               ulong numPoints = reader.getNumPoints();
               Debug.Assert(numPoints == 1065);

               ulong numWritten = writer.write(numPoints);
               Debug.Assert(numWritten == 1065);
           }

           Console.WriteLine("checking output...");

           {
               Options opts = new Options();
               Option opt = new Option();
               opt.setValue_String("foo.laz");
               opt.setName("filename");
               opts.add(opt);

               LasReader reader = new LasReader(opts);
               reader.initialize();

               Debug.Assert(reader.isCompressed() == true);

               ulong numPoints = reader.getNumPoints();
               Debug.Assert(numPoints == 1065);
           }

           Console.WriteLine("done!");

           return;
       }




-- 
Ping Yang, Ph.D.
Postdoctoral Research Associate
Idaho State University-Idaho Falls
yangping at isu.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/pdal/attachments/20111005/620dc5c1/attachment.html


More information about the pdal mailing list