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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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)
   {
      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: [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
        http://lists.osgeo.org/mailman/listinfo/liblas-devel
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
        set
Message-ID:
        <[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:

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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/liblas-devel

End of Liblas-devel Digest, Vol 72, Issue 1
*******************************************
_______________________________________________
Liblas-devel mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/liblas-devel
Loading...