<div dir="ltr"><div>Thank you very much.</div><div><br></div><div>Just to be sure, gdalwarp takes the absolute value of the second tr value independently from the units of the pixel size.</div><div>It can be either meters or degrees depending on the coordinate reference system. Is that correct?</div><div><br></div><div>Thanks again,</div><div>Giovanni<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno sab 18 nov 2023 alle ore 17:27 Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
    
  
  <div>
    <p>Giovanni,</p>
    <p>gdalwarp takes the absolute value of the second tr value, so -tr
      10 -10 is understood as -tr 10 10</p>
    <p>It is expected that gdalinfo reports a negative value for the
      pixel size factor for the vertical axis, as in GeoTIFF when the
      image is north-up, the first line of the image is intended to be
      the one displayed at the top of your screen, and as the line
      number of your screen increase from the top of your screen to the
      bottom, northings or latitudes increase from the bottom to the
      top, hence the negative sign...</p>
    <p>More detailed equivalent explanation at
      <a href="https://gis.stackexchange.com/a/229807/218992" target="_blank">https://gis.stackexchange.com/a/229807/218992</a> (you can ignore the
      paragraph "As to why the image flipped..." which is specific to
      the question in that stackexchange thread)<br>
    </p>
    <p>Even<br>
    </p>
    <div>Le 19/11/2023 à 02:15, Giovanni
      Anconitano via gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hello,<br>
        <br>
        I have a question about how to properly set the -tr flag when
        using gdalwarp.<br>
        In particular, I'm using gdalwarp for resampling a GeoTiff from
        its original resolution to a target resolution. <br>
        Let's consider, for simplicity, the original pixel size equal to
        (5m, 5m) and the target resolution equal to (10m, 10m).<br>
        <br>
        This is the command I use: gdalwarp -tr 10 -10 input.tif
        output.tif<br>
        <br>
        I'm using a negative <yres> because when I open the
        GeoTiff file in QGIS, or if I use gdalinfo, I get a pixel size
        equal to (5, -5) for the source raster.<br>
        <br>
        Is it correct to use a negative <yres> with gdalwarp? I
        also tried -tr 10 10, but the result seems to be the same as the
        case in which I use -tr 10 -10.<br>
        In both cases gdalinfo and QGIS display (10,-10) as the pixel
        size.<br>
        <br>
        How does gdalwarp treat a negative yres value?<br>
        <br>
        <div>Thank you</div>
        <div><br>
        </div>
        <div>Giovanni<br>
        </div>
      </div>
      <br>
      <div style="font-size:small;font-family:arial;background-color:rgb(255,255,255)"><span><span><span><span></span></span></span></span><b>
          <div><font color="#ff0000"><b>Fai crescere le giovani
                ricercatrici e i giovani ricercatori</b><br>
            </font></div>
        </b>
        <div><b><font color="#ff0000">con il 5 per mille alla Sapienza</font><br>
          </b>
          <div>
            <div dir="ltr">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div>
                      <div dir="ltr">
                        <div>
                          <div dir="ltr">
                            <div>
                              <div dir="ltr">
                                <div>
                                  <div>
                                    <div>Scrivi il codice fiscale
                                      dell'Università <b>80209930587<br>
                                        <a href="https://www.uniroma1.it/it/node/23149" target="_blank">Cinque
                                          per mille</a></b></div>
                                  </div>
                                </div>
                                <div><br>
                                </div>
                                <div><img src="https://www.uniroma1.it/sites/default/files/field_galleria/footer_sapienza_romaexpo_.jpg"><br>
                                </div>
                                <div><br>
                                </div>
                                <div><br>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </div>

</blockquote></div>

<br>
<div style="font-size:small;font-family:arial;background-color:rgb(255,255,255)"><span><span><span><span></span></span></span></span><b><div><font color="#ff0000"><b>Fai crescere le giovani ricercatrici e i giovani ricercatori</b><br></font></div></b><div><b><font color="#ff0000">con il 5 per mille alla Sapienza</font><br></b><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div>Scrivi il codice fiscale dell'Università <b>80209930587<br><a href="https://www.uniroma1.it/it/node/23149" target="_blank">Cinque per mille</a></b></div></div></div><div><br></div><div><img src="https://www.uniroma1.it/sites/default/files/field_galleria/footer_sapienza_romaexpo_.jpg"><br></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>