<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello Andrew,</p>
    <p>yes I'm sure. In fact I have some specific nodata pixels in DTM
      but the negative values in the difference cover almost the entire
      image.</p>
    <p>I'm using QGIS to substract both rasters using Raster calculator
      and GDAL Raster calculator but I get identical result.</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">El 25/06/2024 a las 15:58, Andrew Bell
      escribió:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACJ51z0Yq1DQSWJ5fOTEYDXywZq9M=dnmEmMOUTOFhG9g8uNEQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Raul,
        <div><br>
        </div>
        <div>Are you sure you're not seeing places where you have NODATA
          in one raster or the other?</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Tue, Jun 25, 2024 at
          2:09 AM Raúl Casado Barbero <<a
            href="mailto:raul.casado@eez.csic.es" moz-do-not-send="true"
            class="moz-txt-link-freetext">raul.casado@eez.csic.es</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
          <br>
          thank you both. Imodified the pipeline adding origin_x,
          origin_y, width <br>
          and height and now I get consistency inthe new rasters.<br>
          <br>
          The problem is that I still get negative values when I
          substract the MDT <br>
          to MDS. Could it be due to interpolation in the calculation of
          MDT? If I <br>
          get this raster by filtering the vegetation, could it be that
          values <br>
          lower than MDS appear in areas where there is vegetation?<br>
          <br>
          <br>
          Greetings.<br>
          <br>
          El 20/06/2024 a las 16:51, Connor Manning escribió:<br>
          > For general information on how pipelines work:<br>
          > <a
            href="https://pdal.io/en/2.7-maintenance/pipeline.html"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://pdal.io/en/2.7-maintenance/pipeline.html</a><br>
          > And here is the information on the GDAL writer
          specifically, take a<br>
          > look at origin_x and origin_y:<br>
          > <a
href="https://pdal.io/en/2.7-maintenance/stages/writers.gdal.html#writers-gdal"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://pdal.io/en/2.7-maintenance/stages/writers.gdal.html#writers-gdal</a><br>
          ><br>
          > For your pipelines, the GDAL writer is independently
          choosing its own<br>
          > grid each time since you have not specified an origin, so
          the pixels<br>
          > don't line up between the two outputs.  You want to
          explicitly set the<br>
          > same origin, via the above options, for both of your
          writers.gdal<br>
          > outputs to make sure they line up.<br>
          ><br>
          > - Connor<br>
          ><br>
          > On Thu, Jun 20, 2024 at 8:36 AM Raúl Casado Barbero via
          pdal<br>
          > <<a href="mailto:pdal@lists.osgeo.org" target="_blank"
            moz-do-not-send="true" class="moz-txt-link-freetext">pdal@lists.osgeo.org</a>>
          wrote:<br>
          >> Hi Andrew and thaks for your answer.<br>
          >><br>
          >> I'm pretty new with pdal just now and I'm tryingn to
          understand the logic of pipelines... What do you mean with set
          the origin on writers.gdal?<br>
          >><br>
          >><br>
          >> Raúl.<br>
          >><br>
          >> El 20/06/2024 a las 13:45, Andrew Bell escribió:<br>
          >><br>
          >> Hi Raul,<br>
          >><br>
          >> You should set the origin on writers.gdal in order to
          get the consistency you desire. Without this, the origin is
          set according to the first point processed, which may differ
          between pipelines.<br>
          >><br>
          >> On Thu, Jun 20, 2024 at 4:24 AM Raúl Casado Barbero
          via pdal <<a href="mailto:pdal@lists.osgeo.org"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">pdal@lists.osgeo.org</a>>
          wrote:<br>
          >>> Hi,<br>
          >>><br>
          >>> my aim is to calculate the fitovolume of a shrub
          vegetation area. To do that I calculate the DSM, classify a
          point cloud with ground (2) and low vegetation (3) and then
          create a DTM.<br>
          >>><br>
          >>> I use 2 different pipelines (see below) to do
          that modified from this post. But I have 2 issues:<br>
          >>><br>
          >>> When I calculate the difference between DSM and
          DTM I get negative values<br>
          >>> The pixels of the DTM are horizontally displaced
          with respect to the DSM by half a pixel.<br>
          >>><br>
          >>> Does anyone know why I am getting these negative
          values using this pipelines? Is anything wrong in the
          pipelines I`m using?<br>
          >>><br>
          >>><br>
          >>> Raúl.<br>
          >>><br>
          >>> Pipeline for DSM:<br>
          >>><br>
          >>> [<br>
          >>>      "nubeRecortadaPdal_1.laz",<br>
          >>>      {<br>
          >>>          "type": "filters.range",<br>
          >>>          "limits":"returnnumber[1:1]"<br>
          >>>      },<br>
          >>>      {<br>
          >>>          "type": "writers.gdal",<br>
          >>>          "filename":
          "nubeRecortadaPdal_1_mds.tif",<br>
          >>>          "output_type": "idw",<br>
          >>>          "gdaldriver": "GTiff",<br>
          >>>          "resolution": 0.05,<br>
          >>>          "nodata": -9999,<br>
          >>>          "radius": 0.07,<br>
          >>>          "window_size": 50,<br>
          >>>          "data_type": "float32"<br>
          >>>      }<br>
          >>> ]<br>
          >>><br>
          >>> Pipeline for DTM:<br>
          >>><br>
          >>> [<br>
          >>>      "nubeRecortadaPdal_1.laz",<br>
          >>>      {<br>
          >>>          "type":"filters.overlay",<br>
          >>>          "dimension":"Classification",<br>
          >>>         
          "datasource":"D:/Datos/clasificadasVector.gpkg",<br>
          >>>          "layer":"ndviRandomForest",<br>
          >>>          "column":"Id"<br>
          >>>      },<br>
          >>>      {<br>
          >>>          "type":"filters.range",<br>
          >>>          "limits":"Classification[2:2]"<br>
          >>>      },<br>
          >>>      {<br>
          >>>          "type": "writers.gdal",<br>
          >>>          "filename":
          "nubeRecortadaPdal_1_mdt_ndviRf.tif",<br>
          >>>          "output_type": "idw",<br>
          >>>          "gdaldriver": "GTiff",<br>
          >>>          "resolution": 0.05,<br>
          >>>          "nodata": -9999,<br>
          >>>          "radius": 0.07,<br>
          >>>          "window_size": 100,<br>
          >>>          "data_type": "float32"<br>
          >>>      }<br>
          >>> ]<br>
          >>><br>
          >>><br>
          >>> _______________________________________________<br>
          >>> pdal mailing list<br>
          >>> <a href="mailto:pdal@lists.osgeo.org"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">pdal@lists.osgeo.org</a><br>
          >>> <a
            href="https://lists.osgeo.org/mailman/listinfo/pdal"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/pdal</a><br>
          >><br>
          >><br>
          >> --<br>
          >> Andrew Bell<br>
          >> <a href="mailto:andrew.bell.ia@gmail.com"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">andrew.bell.ia@gmail.com</a><br>
          >><br>
          >> --<br>
          >> Raúl Casado Barbero<br>
          >> Servicio de Evaluación, Restauración y Protección de
          Agrosistemas Mediterráneos<br>
          >> Estacion Experimental del Zaidin, CSIC<br>
          >> Calle Profesor Albareda 1, 18008 Granada, Spain<br>
          >> Phone: +34 958181600 VolP CSIC 439186<br>
          >><br>
          >> _______________________________________________<br>
          >> pdal mailing list<br>
          >> <a href="mailto:pdal@lists.osgeo.org"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">pdal@lists.osgeo.org</a><br>
          >> <a
            href="https://lists.osgeo.org/mailman/listinfo/pdal"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/pdal</a><br>
          <br>
          -- <br>
          Raúl Casado Barbero<br>
          Servicio de Evaluación, Restauración y Protección de
          Agrosistemas Mediterráneos<br>
          Estacion Experimental del Zaidin, CSIC<br>
          Calle Profesor Albareda 1, 18008 Granada, Spain<br>
          Phone: +34 958181600 VolP CSIC 439186<br>
          <br>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      <span class="gmail_signature_prefix">-- </span><br>
      <div dir="ltr" class="gmail_signature">Andrew Bell<br>
        <a href="mailto:andrew.bell.ia@gmail.com" target="_blank"
          moz-do-not-send="true" class="moz-txt-link-freetext">andrew.bell.ia@gmail.com</a></div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Raúl Casado Barbero
Servicio de Evaluación, Restauración y Protección de Agrosistemas Mediterráneos
Estacion Experimental del Zaidin, CSIC
Calle Profesor Albareda 1, 18008 Granada, Spain
Phone: +34 958181600 VolP CSIC 439186</pre>
  </body>
</html>