<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 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 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 href="http://i.stack.imgur.com/7HEvc.png" target="_blank">http://i.stack.imgur.com/7HEvc.png</a><br></div><div></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 href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a 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>