<html><head></head><body><div class="ydpe8087276yahoo-style-wrap" style="font-family:times new roman, new york, times, serif;font-size:16px;"><div></div>
<div dir="ltr" data-setdir="false">Hi Regina, </div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Thanks for your message, that's a good tip indeed and I will use from now on; but that wasn't the problem. </div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">The problem was that since I was in wgs84 (<span><span style="color: rgb(38, 40, 42); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">4326), the scale factor would not let me see the geometries. </span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(38, 40, 42); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">After putting scaleX and scaleY to <span><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px;">0.00000227 it did the trick. </span></span></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(38, 40, 42); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px;"><br></span></span></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(38, 40, 42); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px;">Thanks in any case, </span></span></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(38, 40, 42); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px;"><br></span></span></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(38, 40, 42); font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px;">-Lionel</span></span></span></span></div><div><br></div>
</div><div id="ydp842ea59fyahoo_quoted_1939550381" class="ydp842ea59fyahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
Le mercredi 3 juin 2020 à 06:10:57 UTC+2, Regina Obe <lr@pcorp.us> a écrit :
</div>
<div><br></div>
<div><br></div>
<div><div id="ydp842ea59fyiv6294419257"><div><div class="ydp842ea59fyiv6294419257WordSection1"><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-size:11.0pt;font-family:sans-serif;color:#1F497D;">ST_AsRaster has a ton of overloaded formats unfortunately. I suspect your </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-size:11.0pt;font-family:sans-serif;color:#1F497D;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">SELECT ST_ASRaster(ST_SetSRID(ST_EXTENT( myQuads), 4326), 0.1, 0.1 ,'8BUI')</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-size:11.0pt;font-family:sans-serif;color:#1F497D;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-size:11.0pt;font-family:sans-serif;color:#1F497D;">Is falling into the overload</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-size:11.0pt;font-family:sans-serif;color:#1F497D;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><code><span style="font-size:10.0pt;font-family:serif;color:#2E2E2E;background:white;">raster </span></code><code><b><span style="font-size:10.0pt;font-family:serif;color:#446688;background:white;">ST_AsRaster</span></b></code><code><span style="font-size:10.0pt;font-family:serif;color:#2E2E2E;background:white;">(</span></code><span style="font-family:sans-serif;color:#2E2E2E;background:white;">geometry </span><var><span style="font-family:sans-serif;color:#990000;background:white;">geom</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, integer </span><var><span style="font-family:sans-serif;color:#990000;background:white;">width</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, integer </span><var><span style="font-family:sans-serif;color:#990000;background:white;">height</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, text </span><var><span style="font-family:sans-serif;color:#990000;background:white;">pixeltype</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">value=1</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">nodataval=0</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">upperleftx=NULL</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">upperlefty=NULL</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">skewx=0</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">skewy=0</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, boolean </span><var><span style="font-family:sans-serif;color:#990000;background:white;">touched=false</span></var><code><span style="font-size:10.0pt;font-family:serif;color:#2E2E2E;background:white;">)</span></code><span style="font-family:sans-serif;color:#2E2E2E;background:white;">;</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-family:sans-serif;color:#2E2E2E;background:white;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-family:sans-serif;color:#2E2E2E;background:white;">Instead of </span><code><span style="font-size:10.0pt;font-family:serif;color:#2E2E2E;background:white;">raster </span></code><code><b><span style="font-size:10.0pt;font-family:serif;color:#446688;background:white;">ST_AsRaster</span></b></code><code><span style="font-size:10.0pt;font-family:serif;color:#2E2E2E;background:white;">(</span></code><span style="font-family:sans-serif;color:#2E2E2E;background:white;">geometry </span><var><span style="font-family:sans-serif;color:#990000;background:white;">geom</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">scalex</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">scaley</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, text </span><var><span style="font-family:sans-serif;color:#990000;background:white;">pixeltype</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">value=1</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">nodataval=0</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">upperleftx=NULL</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">upperlefty=NULL</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">skewx=0</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, double precision </span><var><span style="font-family:sans-serif;color:#990000;background:white;">skewy=0</span></var><span style="font-family:sans-serif;color:#2E2E2E;background:white;">, boolean </span><var><span style="font-family:sans-serif;color:#990000;background:white;">touched=false</span></var><code><span style="font-size:10.0pt;font-family:serif;color:#2E2E2E;background:white;">)</span></code><span style="font-family:sans-serif;color:#2E2E2E;background:white;">;</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-family:sans-serif;color:#2E2E2E;background:white;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-family:sans-serif;color:#2E2E2E;background:white;">Try explicitly specifying the args</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-family:sans-serif;color:#2E2E2E;background:white;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">SELECT ST_ASRaster(ST_SetSRID(ST_EXTENT( myQuads), 4326), scalex => 0.1, scaley => 0.1 , pixeltype => '8BUI')</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">For older versions of PostgreSQL, you might need to replace the => with :=</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">Hope that helps,</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">Regina</span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-size:11.0pt;font-family:sans-serif;color:#1F497D;"> </span></p><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="font-size:11.0pt;font-family:sans-serif;color:#1F497D;"> </span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt;"><div class="ydp842ea59fyiv6294419257yqt0304697343" id="ydp842ea59fyiv6294419257yqt69459"><div><div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in;"><p class="ydp842ea59fyiv6294419257MsoNormal"><b><span style="font-size:11.0pt;font-family:sans-serif;">From:</span></b><span style="font-size:11.0pt;font-family:sans-serif;"> postgis-users [mailto:postgis-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>Lionel Cayla<br clear="none"><b>Sent:</b> Tuesday, June 2, 2020 9:17 AM<br clear="none"><b>To:</b> postgis-users@lists.osgeo.org<br clear="none"><b>Subject:</b> [postgis-users] Problem with union of rasters (postgis 2.4 rds)</span></p></div></div><p class="ydp842ea59fyiv6294419257MsoNormal"> </p><div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">Hi, </span></p></div></div><div id="ydp842ea59fyiv6294419257ydp5207b0d7yahoo_quoted_2063948840"><div><div><div id="ydp842ea59fyiv6294419257ydp5207b0d7yiv1020533276"><div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">I am having an issue, when rasterizing a union of rasters. Each of the geometries from my initial table are quads or polygons, and the following SQL command </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">(that should work according the documentation right?) gives me a raster 2x2 .</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p></div><div><div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">CREATE TABLE raster_test AS</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">(WITH</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">rast AS (SELECT ST_ASRaster(ST_SetSRID(ST_EXTENT( myQuads), 4326), 0.1, 0.1 ,'8BUI')</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">FROM myDB, </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">WHERE ST_IsValid(myQuads)),</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> raster_ AS (SELECT ST_Union(ST_ASRaster(ST_SetSRID(ST_Force2D( myQuads), 4326), rast.ST_ASRaster), 'SUM')</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">FROM myDB, rast</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">WHERE myQuads IS NOT NULL)</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> SELECT raster_.ST_Union as rast_chunks</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> FROM raster_, rast );</span></p></div></div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">The command produces the desired raster if I replace my resolution (0.1, 0.1) by the raster size if it's equal to 150. Over that (200 say) I get an alignment error message.</span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">I tried to cast 0.1 to double precision I still get an issue. </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">I am wondering if I am doing something wrong here or if there's a known issue. </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">Thanks, </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;"> </span></p></div><div><p class="ydp842ea59fyiv6294419257MsoNormal"><span style="color:#26282A;">-Lio</span></p></div></div></div></div></div></div></div></div></div></div></div><div class="ydp842ea59fyqt0304697343" id="ydp842ea59fyqt97135">_______________________________________________<br clear="none">postgis-users mailing list<br clear="none"><a shape="rect" href="mailto:postgis-users@lists.osgeo.org" rel="nofollow" target="_blank">postgis-users@lists.osgeo.org</a><br clear="none"><a shape="rect" href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="nofollow" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></div></div>
</div>
</div></body></html>