<div style="font-family: Arial, sans-serif; font-size: 14px;"><span>Hi Regina and all,</span><div><br></div><div><span>Elaborating a bit more. I have a vector layer consisting of a rectangle (farm plot), and this rectangle is subdivided into several<span> (<span>polygon</span>s)</span> stripes parallel to the outer edge of the <span>rectangle</span>. I want to produce a raster where the rectangle and stripes long edges are parallel to the latitude line.<br></span></div><div><br></div><div><span>Using ST_Rotate(geom, -0.035, x, y) in all vector layers together with ST_AsRaster(), I managed to get what I want. Good.<br></span></div><div><br></div><span>Nevertheless, if I first produce the raster and then try to rotated it using ST_SetRotation(rast, <span>-0.035</span>), I barely see any rotation. In this step, I must be doing something wrong.<br><span style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><br></span></span></div><div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">I would like to first rasterize vector and then rotate the raster. Instead of rasterize non rotated vector and then, again rasterize rotated vector.<br></div><div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><span><span>The change in size (width and height), I mentioned in my first message, was while testing with 0.5 rad, not with <span>-0.035</span> rad.<br></span></span><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span></span><span></span></div><div style="font-family: "Droid Sans Mono", "monospace", monospace; font-weight: normal; line-height: 19px; white-space: pre; color: rgb(204, 204, 204); background-color: rgb(31, 31, 31);"><span><span style="color: rgb(106, 153, 85);">-- input raster</span></span><div><span style="color: rgb(86, 156, 214);">SELECT</span><span> ST_Width(rast), ST_Height(rast), ST_SkewX(rast) </span><span style="color: rgb(86, 156, 214);">FROM</span><span> plot_3;</span></div><div><span style="color: rgb(106, 153, 85);">-- st_width | st_height | st_skewx </span></div><div><span style="color: rgb(106, 153, 85);">-- ----------+-----------+----------</span></div><div><span style="color: rgb(106, 153, 85);">-- 1000 | 1000 | 0</span></div><br><div><span style="color: rgb(106, 153, 85);">-- output raster of ST_SetRotation(rast, -0.035162353342492736)</span></div><div><span style="color: rgb(86, 156, 214);">SELECT</span><span> ST_Width(rast), ST_Height(rast), ST_SkewX(rast) </span><span style="color: rgb(86, 156, 214);">FROM</span><span> plot_3_rotated_from_raster;</span></div><div><span style="color: rgb(106, 153, 85);">-- st_width | st_height | st_skewx </span></div><div><span style="color: rgb(106, 153, 85);">-- ----------+-----------+----------------------</span></div><div><span style="color: rgb(106, 153, 85);">-- 1000 | 1000 | 0.006952538312005269</span></div><br><div><span style="color: rgb(106, 153, 85);">-- output raster of ST_SetRotation(rast, -0.035162353342492736)</span></div><div><span style="color: rgb(86, 156, 214);">SELECT</span><span> ST_Width(rast), ST_Height(rast), ST_SkewX(rast) </span><span style="color: rgb(86, 156, 214);">FROM</span><span> plot_3_rotated_from_vect;</span></div><div><span style="color: rgb(106, 153, 85);">-- st_width | st_height | st_skewx </span></div><div><span style="color: rgb(106, 153, 85);">-- ----------+-----------+----------</span></div><div><span style="color: rgb(106, 153, 85);">-- 977 | 964 | 0</span></div><br><div><span style="color: rgb(106, 153, 85);">-- output raster of ST_SetRotation(rast, -0.5)</span></div><div><span style="color: rgb(86, 156, 214);">SELECT</span><span> ST_Width(rast), ST_Height(rast), ST_SkewX(rast) </span><span style="color: rgb(86, 156, 214);">FROM</span><span> plot_3_rotated_from_raster_05;</span></div><div><span style="color: rgb(106, 153, 85);">-- st_width | st_height | st_skewx </span></div><div><span style="color: rgb(106, 153, 85);">-- ----------+-----------+---------------------</span></div><div><span style="color: rgb(106, 153, 85);">-- 1000 | 1000 | 0.09481479675190897</span></div></div><br><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Cheers,<br><br></div>
<div class="protonmail_signature_block" style="font-family: Arial, sans-serif; font-size: 14px;">
<div class="protonmail_signature_block-user">
<div><div>Eloi<br></div></div><div><br></div>
</div>
<div class="protonmail_signature_block-proton protonmail_signature_block-empty">
</div>
</div>
<div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div class="protonmail_quote">
On Monday, March 18th, 2024 at 14:01, Regina Obe <lr@pcorp.us> wrote:<br>
<blockquote class="protonmail_quote" type="cite">
<div class="WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt">By size, what do you mean exactly? It would change the width and height.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">What are you expecting rotation to do. Perhaps you can give example out of the below and some sample</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">ST_Width, ST_Height, ST_SkewX before and after and what you were expecting.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"><a href="https://postgis.net/docs/en/RT_ST_SetRotation.html" rel="noreferrer nofollow noopener" target="_blank">https://postgis.net/docs/en/RT_ST_SetRotation.html</a></span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Eloi Ribeiro <mail@eloiribeiro.eu> <br><b>Sent:</b> Monday, March 18, 2024 4:57 AM<br><b>To:</b> PostGIS Users Discussion <postgis-users@lists.osgeo.org><br><b>Subject:</b> How to properly rotate a raster</span></p></div></div><p class="MsoNormal"> </p><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Hi all,</span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><p style="margin-bottom:12.0pt" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">I need to rotate a raster, for that I'm using the function </span><code><b><span style="font-size:10.0pt">ST_SetRotation</span></b></code><code><span style="font-size:10.0pt">, like so:</span></code><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#6A9955">CREATE TABLE plot_3_rotated AS <br>SELECT ST_SetRotation(rast, 0.03516235334249185) rast <br>FROM plot_3;</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">But I see that is not producing the expected results and is changing size of the raster. What am I doing wrong?<br><br>Cheers,</span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><div><div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Eloi</span></p></div></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div></div></div></div></div>
</blockquote><br>
</div>