[Liblas-devel] Creating LAS file, header coordinates doesn't set (Carlos Piury)
Michael Rosen
mrosen at lizardtech.com
Thu Jan 8 13:05:12 PST 2015
You can change the header after you write points. The Writers have an "update_header" call for this purpose.
Here's how we use it:
...
if(m_writer != NULL)
{
if(!failed)
{
m_header->number_of_point_records = m_lasinventory->number_of_point_records;
for (int i = 0; i < 5; i++)
m_header->number_of_points_by_return[i] = m_lasinventory->number_of_points_by_return[i + 1];
m_header->max_x = m_header->get_x(m_lasinventory->max_X);
m_header->min_x = m_header->get_x(m_lasinventory->min_X);
m_header->max_y = m_header->get_y(m_lasinventory->max_Y);
m_header->min_y = m_header->get_y(m_lasinventory->min_Y);
m_header->max_z = m_header->get_z(m_lasinventory->max_Z);
m_header->min_z = m_header->get_z(m_lasinventory->min_Z);
if (! m_writer->update_header(m_header, FALSE, TRUE))
THROW_LIBRARY_ERROR((LTL_STATUS_FORMATS_LIBLAS_WRITER))
("Unable to update header");
}
m_writer->close();
...
-----Original Message-----
From: liblas-devel-bounces at lists.osgeo.org [mailto:liblas-devel-bounces at lists.osgeo.org] On Behalf Of liblas-devel-request at lists.osgeo.org
Sent: Thursday, January 08, 2015 12:00 PM
To: liblas-devel at lists.osgeo.org
Subject: Liblas-devel Digest, Vol 72, Issue 1
Send Liblas-devel mailing list submissions to
liblas-devel at lists.osgeo.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.osgeo.org/mailman/listinfo/liblas-devel
or, via email, send a message with subject or body 'help' to
liblas-devel-request at lists.osgeo.org
You can reach the person managing the list at
liblas-devel-owner at lists.osgeo.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Liblas-devel digest..."
Today's Topics:
1. Creating LAS file, header coordinates doesn't set (Carlos Piury)
----------------------------------------------------------------------
Message: 1
Date: Thu, 8 Jan 2015 13:09:55 +0100
From: Carlos Piury <dgpiury at gmail.com>
To: liblas-devel at lists.osgeo.org
Subject: [Liblas-devel] Creating LAS file, header coordinates doesn't
set
Message-ID:
<CAHMfM_d0ZxumM1eaA3E9FR6a0Q4hwxZXQjMffKvOv0gPUDk0-Q at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi, I am trying to create a LAS file using the c++ API following the tutorial posted in the web page for c++. But when I use "lasinfo" tool for check the result I see the header "MAX X Y Z" and "MIN X Y Z" attribute with value "0" instead of the values with the point that I wrote.
## My code:
main()
{
......
liblas::Header header;
liblas::Writer writer(ofs, header);
liblas::Point point(&header);
point.SetCoordinates(10, 20, 30);
writer.WritePoint(point);
return 0;
}
.....
## Lasinfo Output:
---------------------------------------------------------
Header Summary
---------------------------------------------------------
...
Min X Y Z: 0 0 0
Max X Y Z: 0 0 0
...
Minimum and Maximum Attributes (min,max)
---------------------------------------------------------
Min X, Y, Z: 10, 20, 30
Max X, Y, Z: 10, 20, 30
...
I think (reading the lasinfo code) that lasinfo implementation uses an structure "Summary" and add each point readed to that structure, for this reason the values are right in the second output ("Minimum and Maximum attributes (min,max))". However I don't know if it's possible modify the header after a point is inserted, I tried it unsuccessfully :(.
Someone knows how to modify the header after the "liblas::Writer writer(ofs, header);" call or if the writer implementation must fix the header max and min?
Thanks ;).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/liblas-devel/attachments/20150108/144b56a7/attachment-0001.html>
------------------------------
_______________________________________________
Liblas-devel mailing list
Liblas-devel at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/liblas-devel
End of Liblas-devel Digest, Vol 72, Issue 1
*******************************************
More information about the Liblas-devel
mailing list