<div>Hi Regina and all,<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);">I' seeing different things depending on what application I use. On QGIS the rotated raster appears smaller in width and height. On DBeaver, both rotate, although in different directions.<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;"><span>-- Create raster from polygon (<b>black line</b>)<br></span><div><span>DROP TABLE IF EXISTS public.rast_not_rotated;</span></div><div><span>CREATE TABLE public.rast_not_rotated AS</span></div><div><span>    SELECT ST_AsRaster(t.geom,1000,1000,'8BUI',1,0) AS rast</span></div><div><span>    FROM (SELECT ST_GeomFromText('POLYGON((166989.36462303242 505764.77048559673,</span></div><div><span>                                 166996.25788353998 505576.476318614,</span></div><div><span>                                 167265.54134611748 505585.94966528506,</span></div><div><span>                                 167258.67088940175 505774.2438322678,</span></div><div><span>                                 166989.36462303242 505764.77048559673))',28992) geom) t;</span></div><div><span>ALTER TABLE public.rast_not_rotated ADD COLUMN rid SERIAL PRIMARY KEY;</span></div><div><span>CREATE INDEX rast_not_rotated_rast_gist ON public.rast_not_rotated USING gist (st_convexhull(rast));</span></div><div><span>SELECT AddRasterConstraints('public'::name, 'rast_not_rotated'::name,'rast'::name);</span></div><div><br></div><div><span>-- rotate previous raster (<b>blue</b>)<br></span></div><div><span>DROP TABLE IF EXISTS public.rast_rotated_from_raster;</span></div><div><span>CREATE TABLE public.rast_rotated_from_raster AS SELECT <b>ST_SetRotation</b>(rast, <b>-0.5</b>) rast FROM public.rast_not_rotated;</span></div><div><span>ALTER TABLE public.rast_rotated_from_raster ADD COLUMN rid SERIAL PRIMARY KEY;</span></div><div><span>CREATE INDEX rast_rotated_from_raster_rast_gist ON public.rast_rotated_from_raster USING gist (st_convexhull(rast));</span></div><div><span>SELECT AddRasterConstraints('public'::name, 'rast_rotated_from_raster'::name,'rast'::name);</span></div><div><br></div><div><span>-- rotate polygon and then save as raster (<b>red</b>)<br></span></div><div><span>DROP TABLE IF EXISTS public.rast_rotated_from_vector;</span></div><div><span>CREATE TABLE public.rast_rotated_from_vector AS</span></div><div><span>    SELECT ST_AsRaster(t.geom,1000,1000,'8BUI',1,0) AS rast</span></div><div><span>    FROM (SELECT <b>ST_Rotate</b>(</span></div><div><span>                    ST_GeomFromText('POLYGON((166989.36462303242 505764.77048559673,</span></div><div><span>                                    166996.25788353998 505576.476318614,</span></div><div><span>                                    167265.54134611748 505585.94966528506,</span></div><div><span>                                    167258.67088940175 505774.2438322678,</span></div><div><span>                                    166989.36462303242 505764.77048559673))',28992)</span></div><div><span>                                    ,<b>-0.5</b>, 166989.36462303242, 505764.77048559673) geom) t;</span></div><div><span>ALTER TABLE public.rast_rotated_from_vector ADD COLUMN rid SERIAL PRIMARY KEY;</span></div><div><span>CREATE INDEX rast_rotated_from_vector_rast_gist ON public.rast_rotated_from_vector USING gist (st_convexhull(rast));</span></div><div><span>SELECT AddRasterConstraints('public'::name, 'rast_rotated_from_vector'::name,'rast'::name);</span></div><span></span></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">On QGIS.<br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">black line - <span>raster from polygon</span></div><div style="font-family: Arial, sans-serif; font-size: 14px;">red - the rotated polygon and then converted to raster</div><div style="font-family: Arial, sans-serif; font-size: 14px;">blue - rotated raster, different from how it is displayed in DBeaver.<br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><img alt="Screenshot from 2024-03-21 16-19-54.png" class="proton-embedded" id="imageSelected0" src="cid:64bbfd1d@eloiribeiro.eu"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span><br><span>On <span>DBeaver</span> this is how it shows the <span><span>rotated raster.</span></span></span></span><br><span></span><img alt="Screenshot from 2024-03-21 16-08-36.png" class="proton-embedded" src="cid:d4e48e3a@eloiribeiro.eu"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"></div><div><span><span>On <span>DBeaver</span> this is how it shows the rotated polygon and then converted to raster.<span><span></span></span></span></span></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><img alt="Screenshot from 2024-03-21 16-08-47.png" class="proton-embedded" src="cid:70e90abb@eloiribeiro.eu"></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div class="protonmail_quote">
        On Tuesday, March 19th, 2024 at 14:58, 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">An easier way to compare what is happening is to look at the ST_Polygon output of the two.  <a href="https://postgis.net/docs/en/RT_ST_Polygon.html" rel="noreferrer nofollow noopener" target="_blank">https://postgis.net/docs/en/RT_ST_Polygon.html</a></span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">I’m thinking the confusion (which I had thought myself) is that the width and height is measured against the X y axis, but now I think about it, I think it’s measured along the skew so width and height would remain the same in both cases.  In the case of your polygon you rotate and then save as raster, the new raster is axis aligned and so there you do see the width and height change.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">So when I run this query:</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">SELECT ST_Polygon(r1.rast) AS orig_geom_rast, ST_Polygon(r2.rast) AS rotated_geom_rast, ST_Width(r1.rast) AS orig_width, ST_Width(r2.rast) AS rotated_width</span></p><p class="MsoNormal"><span style="font-size:11.0pt">                FROM (SELECT rast FROM rast_not_rotated) AS r1,</span></p><p class="MsoNormal"><span style="font-size:11.0pt">                                (SELECT ST_SetRotation(rast, -0.5 ) AS rast FROM rast_not_rotated) AS r2;</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">The dashed polygon is the original polygon and the filled in one is after you rotate the raster.  In both cases the ST_Width and ST_Height do not change so that’s not a good measure of what is going on.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><img id="Picture_x0020_1" style="width:4.0312in;height:4.0729in" height="391" width="387" border="0" class="proton-embedded" src="cid:image001.png@01DA79E2.7B978BB0"><span style="font-size:11.0pt"></span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </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> Tuesday, March 19, 2024 6:56 AM<br><b>To:</b> PostGIS Users Discussion <postgis-users@lists.osgeo.org><br><b>Subject:</b> RE: 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"> </span></p></div><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 class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Here an example with the code.</span></p></div><div><p class="MsoNormal">If you compare <u>rast_rotated_from_raster</u> with <u>rast_rotated_from_vector</u>, the latest is rotated as expected and the first is not.</p></div><div><p style="background:white" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">I guess, I must be doing something wrong when creating <u>rast_rotated_from_raster</u>.</span></p></div><div><p style="background:white" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Any guess?</span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#6A9955">-- non rotated raster</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">DROP</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">IF</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">EXISTS</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_not_rotated;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">CREATE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#DCDCAA">public</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">.rast_not_rotated </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">AS</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">    </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> ST_AsRaster(t.geom,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">1000</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">1000</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'8BUI'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">1</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">) </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">AS</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> rast </span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">    </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">FROM</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> (</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> ST_GeomFromText(</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'POLYGON((166989.36462303242 505764.77048559673,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">                                 166996.25788353998 505576.476318614,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">                                 167265.54134611748 505585.94966528506,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">                                 167258.67088940175 505774.2438322678,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">                                 166989.36462303242 505764.77048559673))'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">28992</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">) geom) t;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ALTER</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_not_rotated </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ADD</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> COLUMN rid </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SERIAL</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">PRIMARY KEY</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">CREATE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">INDEX</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#DCDCAA">rast_not_rotated_rast_gist</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ON</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_not_rotated </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">USING</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> gist (st_convexhull(rast));</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> AddRasterConstraints(</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'public'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">, </span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'rast_not_rotated'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'rast'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">);</span></p></div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </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">-- rotate previous raster</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">DROP</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">IF</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">EXISTS</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_rotated_from_raster;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">CREATE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#DCDCAA">public</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">.rast_rotated_from_raster </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">AS</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> ST_SetRotation(rast, </span><span style="font-size:10.5pt;font-family:"Courier New";color:#D4D4D4">-</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">.</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">035162353342492736</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">) rast </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">FROM</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_not_rotated;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ALTER</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_rotated_from_raster </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ADD</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> COLUMN rid </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SERIAL</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">PRIMARY KEY</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">CREATE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">INDEX</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#DCDCAA">rast_rotated_from_raster_rast_gist</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ON</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_rotated_from_raster </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">USING</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> gist (st_convexhull(rast));</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> AddRasterConstraints(</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'public'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">, </span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'rast_rotated_from_raster'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'rast'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">);</span></p></div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </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">-- rotate polygon and then save as raster</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">DROP</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">IF</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">EXISTS</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_rotated_from_vector;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">CREATE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#DCDCAA">public</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">.rast_rotated_from_vector </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">AS</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">    </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> ST_AsRaster(t.geom,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">1000</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">1000</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'8BUI'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">1</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">) </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">AS</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> rast </span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">    </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">FROM</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> (</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> ST_Rotate(</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">                    ST_GeomFromText(</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'POLYGON((166989.36462303242 505764.77048559673,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">                                    166996.25788353998 505576.476318614,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">                                    167265.54134611748 505585.94966528506,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">                                    167258.67088940175 505774.2438322678,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">                                    166989.36462303242 505764.77048559673))'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">28992</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">)</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">                                    ,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#D4D4D4">-</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">.</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">035162353342492736</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">, </span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">166989</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">.</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">36462303242</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">, </span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">505764</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">.</span><span style="font-size:10.5pt;font-family:"Courier New";color:#B5CEA8">77048559673</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">) geom) t;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ALTER</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">TABLE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_rotated_from_vector </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ADD</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> COLUMN rid </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SERIAL</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">PRIMARY KEY</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">CREATE</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">INDEX</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#DCDCAA">rast_rotated_from_vector_rast_gist</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">ON</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> public.rast_rotated_from_vector </span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">USING</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> gist (st_convexhull(rast));</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC"> AddRasterConstraints(</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'public'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">, </span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'rast_rotated_from_vector'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">,</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CE9178">'rast'</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">::</span><span style="font-size:10.5pt;font-family:"Courier New";color:#569CD6">name</span><span style="font-size:10.5pt;font-family:"Courier New";color:#CCCCCC">);</span></p></div></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"> </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><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><p class="MsoNormal">On Monday, March 18th, 2024 at 19:11, Eloi Ribeiro <<a href="mailto:mail@eloiribeiro.eu" rel="noreferrer nofollow noopener" target="_blank">mail@eloiribeiro.eu</a>> wrote:<br><br></p><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Hi Regina and all,</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">Elaborating a bit more. I have a vector layer consisting of a rectangle (farm plot), and this rectangle is subdivided into several (polygons) stripes parallel to the outer edge of the rectangle. I want to produce a raster where the rectangle and stripes long edges are parallel to the latitude line.</span></p></div><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">Using ST_Rotate(geom, -0.035, x, y) in all vector layers together with ST_AsRaster(), I managed to get what I want. Good.</span></p></div><div><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><p style="margin-bottom:12.0pt" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Nevertheless, if I first produce the raster and then try to rotated it using ST_SetRotation(rast, -0.035), I barely see any rotation. In this step, I must be doing something wrong.</span></p></div><div><p style="background:white" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">I would like to first rasterize vector and then rotate the raster. Instead of rasterize non rotated vector and then, again rasterize rotated vector.</span></p></div><div><p style="background:white" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> </span></p></div><div><p style="margin-bottom:12.0pt;background:white" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">The change in size (width and height), I mentioned in my first message, was while testing with 0.5 rad, not with -0.035 rad.</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">-- input raster</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-family:"Courier New";color:#CCCCCC"> ST_Width(rast), ST_Height(rast), ST_SkewX(rast) </span><span style="font-family:"Courier New";color:#569CD6">FROM</span><span style="font-family:"Courier New";color:#CCCCCC"> plot_3;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">--  st_width | st_height | st_skewx </span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">-- ----------+-----------+----------</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">--      1000 |      1000 |        0</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#CCCCCC"> </span></p><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">-- output raster of ST_SetRotation(rast, -0.035162353342492736)</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-family:"Courier New";color:#CCCCCC"> ST_Width(rast), ST_Height(rast), ST_SkewX(rast) </span><span style="font-family:"Courier New";color:#569CD6">FROM</span><span style="font-family:"Courier New";color:#CCCCCC"> plot_3_rotated_from_raster;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">--  st_width | st_height |       st_skewx       </span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">-- ----------+-----------+----------------------</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">--      1000 |      1000 | 0.006952538312005269</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#CCCCCC"> </span></p><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">-- output raster of ST_SetRotation(rast, -0.035162353342492736)</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-family:"Courier New";color:#CCCCCC"> ST_Width(rast), ST_Height(rast), ST_SkewX(rast) </span><span style="font-family:"Courier New";color:#569CD6">FROM</span><span style="font-family:"Courier New";color:#CCCCCC"> plot_3_rotated_from_vect;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">--  st_width | st_height | st_skewx </span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">-- ----------+-----------+----------</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">--       977 |       964 |        0</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#CCCCCC"> </span></p><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">-- output raster of ST_SetRotation(rast, -0.5)</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#569CD6">SELECT</span><span style="font-family:"Courier New";color:#CCCCCC"> ST_Width(rast), ST_Height(rast), ST_SkewX(rast) </span><span style="font-family:"Courier New";color:#569CD6">FROM</span><span style="font-family:"Courier New";color:#CCCCCC"> plot_3_rotated_from_raster_05;</span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">--  st_width | st_height |      st_skewx       </span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">-- ----------+-----------+---------------------</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div><div><p style="line-height:14.25pt;background:#1F1F1F" class="MsoNormal"><span style="font-family:"Courier New";color:#6A9955">--      1000 |      1000 | 0.09481479675190897</span><span style="font-family:"Courier New";color:#CCCCCC"></span></p></div></div><p class="MsoNormal"> </p><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">Cheers,</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><p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><p class="MsoNormal">On Monday, March 18th, 2024 at 14:01, Regina Obe <<a href="mailto:lr@pcorp.us" rel="noreferrer nofollow noopener" target="_blank">lr@pcorp.us</a>> wrote:<br><br></p><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" 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 style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" 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 style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" 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 style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:11.0pt"><a target="_blank" href="https://postgis.net/docs/en/RT_ST_SetRotation.html" rel="noreferrer nofollow noopener">https://postgis.net/docs/en/RT_ST_SetRotation.html</a></span></p><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" 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 style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" 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 <<a href="mailto:mail@eloiribeiro.eu" rel="noreferrer nofollow noopener" target="_blank">mail@eloiribeiro.eu</a>> <br><b>Sent:</b> Monday, March 18, 2024 4:57 AM<br><b>To:</b> PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" rel="noreferrer nofollow noopener" target="_blank">postgis-users@lists.osgeo.org</a>><br><b>Subject:</b> How to properly rotate a raster</span></p></div></div><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"> </p><div><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Hi all,</span></p></div><div><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><p style="mso-margin-top-alt:auto;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="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;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></p></div><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" 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 style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div><div><div><div><div><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Eloi</span></p></div></div><div><p style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto" class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"> </span></p></div></div></div></div></div></blockquote><p class="MsoNormal"> </p></div></blockquote><p class="MsoNormal"> </p></div></div></div>
        </blockquote><br>
    </div>