Hello,<br><br>My work on liblas::Writer::WritePoint() was delayed by other tasks and I just resume it recently. <br><br>Now I implemented what we talked about (but with some small changes).   I tested it and it worked in unit test.   However,  in real cases to use it,  we still have two problems to solve. <br>

<br><br>First, to in-place update a point in LIDAR file,  we need to know the absolute index of that point.  However, currently liblas cannot provide this information.  I thought I could use accumulated point count as the point&#39;s index when I read points one by one using ReadNextPoint(). But when liblas:Reader has  filter(s),  ReadNextPoint() only returns part of points but not whole point set.<br>

<br>To solve this problem, I  think we can add a member variable, m_AbsoluteIndex, to liblas::Point.  Then we can also store the absolute index of the point in liblas::detail::ReadNextPoint() .  <br><br><br><br>Second, sometime we need read-writer besides reader and writer.  For example,  if the user changes some points and wants to update the changes to the LIDAR file and continue editing,  without ReaderUpdater, the user need to store all the changes in the memory, close current reader, create a writer for the file, update the points,  close the writer, then use the reader to open the file again.  This procedure is not convenient, and memory consuming when large amount of points need to be changed. <br>

<br>To implement a ReaderUpdater (or ReaderWriter),  I think we can do the following:   <br><br>1.<br>Add ReaderUpdaterI  in liblas.hpp: <br>class ReaderUpdaterI : public ReaderI<br>{<br>public:<br><br>        virtual bool OverwritePoint(const Point&amp; point, std::size_t pointIndex) = 0;<br>

<br>    virtual ~ReaderExI() {}<br><br>};<br><br>2. <br>Add a class, liblas:detail:ReaderUpdater <br><br>class liblias::detail::ReaderUpdater : public ReaderUpdaterI<br>{<br>public:<br>        bool OverwritePoint(liblas::Point const&amp; point, std::size_t pointIndex);<br>

<br>private:<br>       liblas::detail::Reader  *  m_reader;    // or use shared pointer  like ReaderPtr<br>}<br><br><br>3.  <br>Of course,  add class liblas::ReaderUpdater  to wrap liblas::detail::ReaderUpdater<br><br><br>

How do you think of these changes?  Will they break current design and/or other software that use liblas?  <br><br>Thanks,<br>Hongwei Shen<br><br><br><br><br>On Fri, Jan 6, 2012 at 4:10 PM, Howard Butler &lt;<a href="mailto:hobu.inc@gmail.com">hobu.inc@gmail.com</a>&gt; wrote:<br>

&gt; If you do work to add this, you&#39;ll probably just need to add a seek() method to the liblas::Writer class (and underlying implementation classes) that positions the stream.  After that liblas::Writer::WritePoint() should overwrite the data, though you may want to do some header checks to make sure that the size in bytes of the point is the same as the size in bytes that the file is expecting -- otherwise you&#39;d start clobbering data.<br>

&gt;<br>&gt; On Jan 6, 2012, at 2:36 PM, Hongwei Shen wrote:<br>&gt;<br>&gt;&gt; Thank you for the answer, Howard.<br>&gt;&gt;<br>&gt;&gt; I&#39;ll check if I can add this support.<br>&gt;&gt;<br>&gt;&gt; Thanks,<br>&gt;&gt; Hongwei<br>

&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; On Fri, Jan 6, 2012 at 1:47 PM, Howard Butler &lt;<a href="mailto:hobu.inc@gmail.com">hobu.inc@gmail.com</a>&gt; wrote:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; On Jan 6, 2012, at 12:16 PM, Hongwei Shen wrote:<br>

&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; Hello,<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; The scenario is: the user opens a large Lidar file,  changes the<br>&gt;&gt;&gt;&gt; classification labels of a small number of points and save the changes<br>

&gt;&gt;&gt;&gt; to the file.  When the Lidar file is huge, it is time-consuming to<br>&gt;&gt;&gt;&gt; output all the points. So it would be better if only the modified<br>&gt;&gt;&gt;&gt; points are updated in the Lidar file.  According to my understanding<br>

&gt;&gt;&gt;&gt; now, Liblas needs to save  all the (changed and unchanged) points to a<br>&gt;&gt;&gt;&gt; new Lidar file. That&#39;s because Liblas can open a Lidar file either in<br>&gt;&gt;&gt;&gt; read-only mode or write-only mode, but not in read-write mode.<br>

&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; Do I understand correctly?  Is there a way to only update some points?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Yes, your understanding is correct. libLAS does not support in-place updating of points.<br>

&gt;&gt;&gt;<br>&gt;&gt;&gt; Howard<br>&gt;&gt;&gt;<br>&gt;<br><br>