On Feb 23, 2009, at 4:42 PM, Neil Woodhouse wrote:

Howard,

        Some additional points. I am using the C API, so I don't think
that the repair utility is available to me.

lasinfo's repair operations work by opening the LASWriterH in append mode. lasinfo.c uses the C API. See the code in lasinfo.c for more information


Here some pseudo code to
indicate my quandary.

        Create the header, point and writer
        For all blocks of data
                Process the data block
                Add the point to the LAS file
                Accumulate the bounds of the points
        Write the header
        Close the file


Can you try the following?:

        Create the header, point, and writer
        For all blocks of data
                process
                add the point to the LASWriterH with _WritePoint
                accumulate the bounds of the points
* Close the file with LASWriter_Destroy when you're done writing your points. * Open the file with LASReader_Create and fetch a copy of the LASHeaderH then LASReader_Destroy * Set the extents and other items you wish to tweak on this copy. Don't mess with the point count, VLRs, or any other things that might cause things to blow up * Open the file with LASWriter_Create in Append mode using your header copy
        * Destroy the LASWriterH again with LASWriter_Destroy
        



        We are not using any VLR records, but do use the set user data
function (LASPoint_SetUserData) for the point. I understand that this is
an unsigned char.

UserData for 1.1 is a single unsigned char, right? I will update my test case to try this.


BTW do you know of any free viewers that can view
this?

View the user data? I would assume that by definition, only the application that created it would know how to interpret it.

The reason for this workflow is that we do not know the number of
points upfront and don't know the extents of them.

The LASWriter does not know the number of points it will write and will do so with UpdateHeader for you as you destroy the writer with LASWriter_Destroy or ~LASWriter when it goes out of scope. As for the extents, I think the only way to currently update them now is using the pseudocode I described (it should be the same thing as what's currently in lasinfo)

Hope this helps,

Howard

_______________________________________________
Liblas-devel mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/liblas-devel

Reply via email to