<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=PT-BR link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I created a retangular raster representing number of lightnings in a square. So I have this matrix raster created using ST_MapAlgebraFct and ST_MakeEmptyRaster. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>This raster is not a tiled raster (tb_densitysurface), and when I Clip this raster using a polygon, the query below, the performance is not good.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Maybe because the raster is not tiled. So how do I tile this raster ? And I want the result to be a raster (not gval) to be exported as a file, and then colored using GDAL.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>It worked with a different query only using ST_Clip (this returns a rast column and is very fast), but the edges arenīt smooth as using ST_Insersection. I am using Postgis 2.5.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>SELECT<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    (gval).val<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    (gval).geom<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>FROM (<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    SELECT ST_Intersection(<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>        ST_Clip(rast,ST_Envelope(area_country)),<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>        1,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>       area_country<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    ) As gval<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    FROM country, tb_densitysurface WHERE ST_Intersects(rast, area_country) and country.gid = 19<o:p></o:p></span></p><p class=MsoNormal>) As foo<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='mso-fareast-language:PT-BR'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:PT-BR'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:PT-BR'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:PT-BR'>Liglio<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>