<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 17/11/2022 à 16:01, Brendan
      Heberlein a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:DM6PR06MB437799108116972CA9F3DBE4BA3D9@DM6PR06MB4377.namprd06.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Thank you, Mike & Even.</div>
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Supposing I wanted to have the output grid origin &
        dimensions computed automatically, but with a specified rotation
        angle, is that possible?</div>
    </blockquote>
    <p>There's no API in GDAL for it. You indeed have to set something
      like the following<br>
    </p>
    <p><br>
    </p>
    <p>gt[1] = cos(angle) * pixel_x_size</p>
    <p>gt[2] = -sin(angle) * pixel_x_size</p>
    <p>gt[4] = sin(angle) * pixel_y_size</p>
    <p>gt[5] = cos(angle) * pixel_y_size</p>
    <p><br>
    </p>
    <p>I assume the above only works if the origin (gt[0], gt[3]) is the
      lower-left corner coordinate, not the upper-one. And I might
      certainly have got some signs wrong :-)</p>
    <p><br>
    </p>
    <p>Slightly related code in the ENVI driver to transform the
      rotation angle from its header file to a geotransform matrix (but
      conventions might be slightly different):</p>
    <p><a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/blob/66d9fe0b1a34a8992c804c2444f7f23c2436b937/frmts/raw/envidataset.cpp#L1536">https://github.com/OSGeo/gdal/blob/66d9fe0b1a34a8992c804c2444f7f23c2436b937/frmts/raw/envidataset.cpp#L1536</a><br>
    </p>
    <blockquote type="cite"
cite="mid:DM6PR06MB437799108116972CA9F3DBE4BA3D9@DM6PR06MB4377.namprd06.prod.outlook.com">
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Anyway I can calculate these parameters myself, so it is not a
        big issue. Your suggestion worked for me.</div>
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Cheers!</div>
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        Brendan</div>
      <div class="elementToProof"
        style="font-family:Calibri,Arial,Helvetica,sans-serif;
        font-size:12pt; color:rgb(0,0,0);
        background-color:rgb(255,255,255)">
        <br>
      </div>
      <hr tabindex="-1" style="display:inline-block; width:98%">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>From:</b> Even
          Rouault <a class="moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a><br>
          <b>Sent:</b> Saturday, November 5, 2022 4:36 AM<br>
          <b>To:</b> Michael Sumner <a class="moz-txt-link-rfc2396E" href="mailto:mdsumner@gmail.com"><mdsumner@gmail.com></a>; Brendan
          Heberlein <a class="moz-txt-link-rfc2396E" href="mailto:bheberlein@wisc.edu"><bheberlein@wisc.edu></a><br>
          <b>Cc:</b> gdal-dev <a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev@lists.osgeo.org"><gdal-dev@lists.osgeo.org></a><br>
          <b>Subject:</b> Re: [gdal-dev] Specify Grid Rotation for
          gdal.Warp() with Geolocation Arrays</font>
        <div> </div>
      </div>
      <div class="elementToProof">
        <p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px;
          margin-bottom:0px">
          <br>
        </p>
        <div class="x_moz-cite-prefix">Le 05/11/2022 à 04:33, Michael
          Sumner a écrit :<br>
        </div>
        <blockquote type="cite">
          <div dir="ltr">yes I see, well you can probably set a target
            GeoTIFF with the geotransform that you want - and gdalwarp
            to that as the target.
            <br>
          </div>
        </blockquote>
        <p class="elementToProof" style="margin-top: 0px; margin-bottom:
          0px;margin-top:0px; margin-bottom:0px">
          something like</p>
        <p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px;
          margin-bottom:0px">
          out_ds = gdal.GetDriverByName("GTiff").Create("output.tif",
          width, height, number_of_bands, data_type, options =
          ["TILED=YES"])</p>
        <p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px;
          margin-bottom:0px">
          out_ds.SetGeoTransform([ some geotransform with rotational
          terms ])</p>
        <p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px;
          margin-bottom:0px">
          srs = osr.SpatialReference()</p>
        <p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px;
          margin-bottom:0px">
          srs.ImportFromEPSG( xxx ) / srs.ImportFromWkt( xxx )<br>
        </p>
        <p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px;
          margin-bottom:0px">
          out_ds.SetSpatialRef( srs )</p>
        gdal.Warp(out_ds, src_ds, .... )<br>
        <p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px;
          margin-bottom:0px">
          <br>
        </p>
        <p style="margin-top: 0px; margin-bottom: 0px;margin-top:0px;
          margin-bottom:0px">
          <br>
        </p>
        <blockquote type="cite">
          <div dir="ltr">I don't believe you can do that with gdalwarp
            directly, and I have no idea with python - and finally I'm
            sorry to add irrelevant discussion - but this is interesting
            and I'm going to try it out in R and C++ and would love to
            see a python example too. 
            <div><br>
            </div>
            <div>Cheers, Mike</div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div><br>
              <div><br>
              </div>
            </div>
          </div>
          <br>
          <div class="x_gmail_quote">
            <div dir="ltr" class="x_gmail_attr">On Sat, Nov 5, 2022 at
              2:21 PM Brendan Heberlein <<a
                href="mailto:bheberlein@wisc.edu"
                data-auth="NotApplicable" class="x_moz-txt-link-freetext
                moz-txt-link-freetext" moz-do-not-send="true">bheberlein@wisc.edu</a>>
              wrote:<br>
            </div>
            <blockquote class="x_gmail_quote" style="margin:0px 0px 0px
              0.8ex; border-left:1px solid rgb(204,204,204);
              padding-left:1ex">
              <div class="x_msg-8414452608495145630">
                <div dir="ltr">
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                    Hi Mike,</div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                    <br>
                  </div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                    regardless of the map projection, it may be
                    desirable to have the grid oriented in one direction
                    or another, e.g. due to the spatial distribution of
                    data points. Although the CRS/SRS designates the
                    coordinate axes, these are not always aligned with
                    the desired grid orientation.</div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                    <br>
                  </div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                    So, basically I want to be able to specify an
                    arbitrary geotransform array for the output grid.
                    This would allow the grid to be assigned an
                    arbitrary orientation within the CRS frame.</div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                    <br>
                  </div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                    Thanks,</div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                    Brendan</div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                  </div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                  </div>
                  <div
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:12pt; color:rgb(0,0,0);
                    background-color:rgb(255,255,255)">
                  </div>
                  <hr style="display:inline-block; width:98%">
                  <div id="x_m_-4105275956097184085divRplyFwdMsg"
                    dir="ltr"><font style="font-size:11pt"
                      face="Calibri, sans-serif" color="#000000"><b>From:</b>
                      Michael Sumner <<a
                        href="mailto:mdsumner@gmail.com"
                        data-auth="NotApplicable"
                        class="x_moz-txt-link-freetext
                        moz-txt-link-freetext" moz-do-not-send="true">mdsumner@gmail.com</a>><br>
                      <b>Sent:</b> Friday, November 4, 2022 6:57 PM<br>
                      <b>To:</b> Brendan Heberlein <<a
                        href="mailto:bheberlein@wisc.edu"
                        data-auth="NotApplicable"
                        class="x_moz-txt-link-freetext
                        moz-txt-link-freetext" moz-do-not-send="true">bheberlein@wisc.edu</a>><br>
                      <b>Cc:</b> gdal-dev <<a
                        href="mailto:gdal-dev@lists.osgeo.org"
                        data-auth="NotApplicable"
                        class="x_moz-txt-link-freetext
                        moz-txt-link-freetext" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>><br>
                      <b>Subject:</b> Re: [gdal-dev] Specify Grid
                      Rotation for gdal.Warp() with Geolocation Arrays</font>
                    <div> </div>
                  </div>
                  <div>
                    <div dir="auto">well, the map projection does this -
                      there are many possibilities. Or, do you have
                      another geolocation array you want as the target? 
                      <div dir="auto"><br>
                      </div>
                      <div dir="auto">If you have an example I'm happy
                        to try a few things, but I'd assumed you had a
                        target map projection in mind. What kind of crs
                        to choose depends on your goal, or is purely to
                        not have north up? </div>
                      <div dir="auto"><br>
                      </div>
                      <div dir="auto">Perhaps there's something
                        terminology wise I'm missing ...</div>
                      <div dir="auto"><br>
                      </div>
                      <div dir="auto">Mike</div>
                    </div>
                    <br>
                    <div>
                      <div dir="ltr">On Sat, 5 Nov 2022, 10:50 Brendan
                        Heberlein, <<a
                          href="mailto:bheberlein@wisc.edu"
                          data-auth="NotApplicable"
                          class="x_moz-txt-link-freetext
                          moz-txt-link-freetext" moz-do-not-send="true">bheberlein@wisc.edu</a>>
                        wrote:<br>
                      </div>
                      <blockquote style="margin:0px 0px 0px 0.8ex;
                        border-left:1px solid rgb(204,204,204);
                        padding-left:1ex">
                        <div dir="ltr">
                          <div
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:12pt; color:rgb(0,0,0);
                            background-color:rgb(255,255,255)">
                            Hi Mike,</div>
                          <div
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:12pt; color:rgb(0,0,0);
                            background-color:rgb(255,255,255)">
                            <br>
                          </div>
                          <div
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:12pt; color:rgb(0,0,0);
                            background-color:rgb(255,255,255)">
                            thanks for the response.</div>
                          <div
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:12pt; color:rgb(0,0,0);
                            background-color:rgb(255,255,255)">
                            <br>
                          </div>
                          <div
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:12pt; color:rgb(0,0,0);
                            background-color:rgb(255,255,255)">
                            Can you clarify how I would go about
                            specifying the grid orientation for the
                            output raster? None of -te, -ts or -t_srs
                            address this.</div>
                          <div
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:12pt; color:rgb(0,0,0);
                            background-color:rgb(255,255,255)">
                          </div>
                          <div
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:12pt; color:rgb(0,0,0);
                            background-color:rgb(255,255,255)">
                            <br>
                          </div>
                          <div
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:12pt; color:rgb(0,0,0);
                            background-color:rgb(255,255,255)">
                            <br>
                          </div>
                          <hr style="display:inline-block; width:98%">
                          <div
                            id="x_m_-4105275956097184085x_m_219862940684509146divRplyFwdMsg"
                            dir="ltr"><font style="font-size:11pt"
                              face="Calibri, sans-serif" color="#000000"><b>From:</b>
                              Michael Sumner <<a
                                href="mailto:mdsumner@gmail.com"
                                data-auth="NotApplicable"
                                class="x_moz-txt-link-freetext
                                moz-txt-link-freetext"
                                moz-do-not-send="true">mdsumner@gmail.com</a>><br>
                              <b>Sent:</b> Friday, November 4, 2022 6:41
                              PM<br>
                              <b>To:</b> Brendan Heberlein <<a
                                href="mailto:bheberlein@wisc.edu"
                                data-auth="NotApplicable"
                                class="x_moz-txt-link-freetext
                                moz-txt-link-freetext"
                                moz-do-not-send="true">bheberlein@wisc.edu</a>><br>
                              <b>Cc:</b> gdal-dev <<a
                                href="mailto:gdal-dev@lists.osgeo.org"
                                data-auth="NotApplicable"
                                class="x_moz-txt-link-freetext
                                moz-txt-link-freetext"
                                moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>><br>
                              <b>Subject:</b> Re: [gdal-dev] Specify
                              Grid Rotation for gdal.Warp() with
                              Geolocation Arrays</font>
                            <div> </div>
                          </div>
                          <div>
                            <div dir="auto">that's exactly what the
                              warper does with geolocation arrays, set
                              the target extent, dimension, and crs with
                              -te, -ts, -t_srs with gdalwarp.
                              <div dir="auto"><br>
                              </div>
                              <div dir="auto">python will have those
                                analogous controls for the warper.</div>
                              <div dir="auto"><br>
                              </div>
                              <div dir="auto">Cheers, Mike</div>
                              <div dir="auto"><br>
                              </div>
                              <div dir="auto"><br>
                              </div>
                            </div>
                            <br>
                            <div>
                              <div dir="ltr">On Sat, 5 Nov 2022, 01:23
                                Brendan Heberlein via gdal-dev, <<a
                                  href="mailto:gdal-dev@lists.osgeo.org"
                                  data-auth="NotApplicable"
                                  class="x_moz-txt-link-freetext
                                  moz-txt-link-freetext"
                                  moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>>
                                wrote:<br>
                              </div>
                              <blockquote style="margin:0px 0px 0px
                                0.8ex; border-left:1px solid
                                rgb(204,204,204); padding-left:1ex">
                                <div dir="ltr">
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    Hello,</div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    <br>
                                  </div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    I would like to be able to warp an
                                    image dataset using a geolocation
                                    array, while specifying the grid to
                                    which the output dataset is sampled.
                                    Specifically, I want to be able to
                                    warp the dataset to a grid which is
                                    not oriented North-up.</div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    <br>
                                  </div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    Can GDAL support this currently? Or,
                                    what is the likelihood this could be
                                    supported in the future?</div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    <br>
                                  </div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    I primarily rely on the Python
                                    bindings, so a solution within that
                                    framework would be ideal for me.</div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    <br>
                                  </div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    Thanks!</div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                         — Brendan</div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    <br>
                                  </div>
                                  <div
                                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                                    font-size:12pt; color:rgb(0,0,0);
                                    background-color:rgb(255,255,255)">
                                    <br>
                                  </div>
                                </div>
_______________________________________________<br>
                                gdal-dev mailing list<br>
                                <a
                                  href="mailto:gdal-dev@lists.osgeo.org"
                                  data-auth="NotApplicable"
                                  class="x_moz-txt-link-freetext
                                  moz-txt-link-freetext"
                                  moz-do-not-send="true">gdal-dev@lists.osgeo.org</a><br>
                                <a
                                  href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
                                  data-auth="NotApplicable"
                                  class="x_moz-txt-link-freetext
                                  moz-txt-link-freetext"
                                  moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
                              </blockquote>
                            </div>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div dir="ltr" class="x_gmail_signature">Michael Sumner<br>
            Software and Database Engineer<br>
            Australian Antarctic Division<br>
            Hobart, Australia<br>
            e-mail: <a href="mailto:mdsumner@gmail.com"
              data-auth="NotApplicable" class="x_moz-txt-link-freetext
              moz-txt-link-freetext" moz-do-not-send="true">
              mdsumner@gmail.com</a></div>
          <br>
          <fieldset class="x_moz-mime-attachment-header"></fieldset>
          <pre class="x_moz-quote-pre">_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" data-auth="NotApplicable" class="x_moz-txt-link-abbreviated moz-txt-link-freetext" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" data-auth="NotApplicable" class="x_moz-txt-link-freetext moz-txt-link-freetext" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
        </blockquote>
        <pre class="x_moz-signature" cols="72">-- 
<a href="http://www.spatialys.com" data-auth="NotApplicable" class="x_moz-txt-link-freetext moz-txt-link-freetext" moz-do-not-send="true">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>