Re: [Liblas-devel] Creating LAS file, header coordinates doesn't set (Carlos Piury)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: [Liblas-devel] Creating LAS file, header coordinates doesn't set (Carlos Piury)

Michael Rosen
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)
         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))
            ("Unable to update header");


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Thursday, January 08, 2015 12:00 PM
To: [hidden email]
Subject: Liblas-devel Digest, Vol 72, Issue 1

Send Liblas-devel mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

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 <[hidden email]>
To: [hidden email]
Subject: [Liblas-devel] Creating LAS file, header coordinates doesn't
        <[hidden email]>
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:

      liblas::Header header;
      liblas::Writer writer(ofs, header);
      liblas::Point point(&header);
      point.SetCoordinates(10, 20, 30);

      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: <>


Liblas-devel mailing list
[hidden email]

End of Liblas-devel Digest, Vol 72, Issue 1
Liblas-devel mailing list
[hidden email]