<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font face="Times New Roman, Times, serif">The only way would be
      then to concatenate the transformations: first rotate and then
      translate half a pixel width. The computation can be simplified by
      matrix multiplication:<br>
      <br>
<a class="moz-txt-link-freetext" href="http://www.mathplanet.com/education/geometry/transformations/transformation-using-matrices">http://www.mathplanet.com/education/geometry/transformations/transformation-using-matrices</a><br>
      <br>
      Jan<br>
    </font>
    <blockquote
cite="mid:CAEVk4t0fze0NvqTBELJEZuC6+ixMJ8xX+irb_ZT=bZijBdp_Dg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div dir="ltr">That won't work, since it will move the corner
        point half a cell, and then rotate around the new corner.
        <div><br>
        </div>
        <div>- Øyvind</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Mon, Aug 26, 2013 at 7:02 PM, Norman
          Vine <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:nhv@cape.com" target="_blank">nhv@cape.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div style="word-wrap:break-word"><br>
              <div>
                <div>
                  <div class="h5">
                    <div>On Aug 26, 2013, at 12:50 PM, Oyvind Idland
                      <<a moz-do-not-send="true"
                        href="mailto:oyvind.idland@gmail.com"
                        target="_blank">oyvind.idland@gmail.com</a>>
                      wrote:</div>
                    <br>
                    <blockquote type="cite">
                      <div dir="ltr">
                        <div>
                          <div>
                            <div>I am currently working on a driver for
                              a proprietary format, which is being
                              consumed by ArcGis via GDAL.<br>
                              <br>
                            </div>
                            These grids sometimes has a rotation with a
                            specified pivot point. I managed to get
                            ArcGis to display the rotated grid by doing
                            the following: <br>
                            <br>
                            poDS->dGeoTransform[0] = originX;<br>
                            poDS->dGeoTransform[1] = cos(rotation) *
                            cellSizeX;<br>
                            poDS->dGeoTransform[2] = -sin(rotation) *
                            cellSizeX;<br>
                            poDS->dGeoTransform[3] = originY;<br>
                            poDS->dGeoTransform[4] = sin(rotation) *
                            cellSizeY;<br>
                            poDS->dGeoTransform[5] = cos(rotation) *
                            cellSizeY;<br>
                            <br>
                          </div>
                          Rotation is in radians. It works, but there is
                          one problem: I need to rotate the grid around
                          the center of the corner cell (originX,
                          originY), but ends up getting rotation around
                          the corner of the cell/raster instead.<br>
                          <br>
                        </div>
                        <div>There is a screenshot here, showing only
                          the corner pixel. The topmost grid/pixel was
                          translated using custom geotransform in
                          ArcGis, the bottom one is the result of my
                          GDAL rotation:<br>
                          The cyan dot shows the pivot point:<br>
                          <br>
                          <a moz-do-not-send="true"
                            href="http://i.stack.imgur.com/7HEvc.png"
                            target="_blank">http://i.stack.imgur.com/7HEvc.png</a><br>
                        </div>
                        <div><br>
                          <br>
                        </div>
                        Is there any way to express this translation
                        using the geotransform matrix ?<br>
                      </div>
                    </blockquote>
                    <div><br>
                    </div>
                  </div>
                </div>
                <div>I think this should work</div>
                <div>
                  <div><br>
                  </div>
                  <div>poDS->dGeoTransform[0] = originX +
                    cellSizeX/2.0;</div>
                  <div class="im">
                    <div>poDS->dGeoTransform[1] = cos(rotation) *
                      cellSizeX;</div>
                    <div>poDS->dGeoTransform[2] = -sin(rotation) *
                      cellSizeX;</div>
                  </div>
                  <div>poDS->dGeoTransform[3] = originY -
                    cellSizeY/2.0;</div>
                  <div class="im">
                    <div>poDS->dGeoTransform[4] = sin(rotation) *
                      cellSizeY;</div>
                    <div>
                      poDS->dGeoTransform[5] = cos(rotation) *
                      cellSizeY;</div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            gdal-dev mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.osgeo.org/mailman/listinfo/gdal-dev"
              target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>