<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>
<body>
<div name="messageBodySection">
<div dir="auto">Tested with:<br>
1 … table=rastertable WHERE=rid>0" dest.tif <br>
Returns:<br>
WHERE=rid>0 has no raster bands<br>
<br>
2 … table=rastertable WHERE=rid=1" dest.tif <br>
Returns:<br>
a valid but empty tif file<br>
<br>
3 … table=<view based on the rastertable" dest.tif <br>
Returns:<br>
... has no raster bands<br>
<br>
gdalwarp seems to treat PostGIS raster tables as one subdataset for each tile. Basically make them useless in my mind - or have I missed something essential/simple ?<br>
<br>
</div>
</div>
<div name="messageSignatureSection"><br>
<div class="matchFont">Hälsningar<br>
<br>
Andreas Oxenstierna<br>
T-Kartor Geospatial AB<br>
Olof Mohlins väg 12 Kristianstad<br>
mobile: +46 733 206831<br>
mailto: <a href="mailto:andreas.oxenstierna@t-kartor.com">andreas.oxenstierna@t-kartor.com</a><br>
<a href="http://www.t-kartor.com">www.t-kartor.com</a></div>
</div>
<div name="messageReplySection">On 11 May 2021, 08:48 +0200, Andreas Oxenstierna <andreas.oxenstierna@t-kartor.com>, wrote:<br>
<blockquote type="cite" style="border-left-color: grey; border-left-width: thin; border-left-style: solid; margin: 5px 5px;padding-left: 10px;">
<div name="messageBodySection">
<div dir="auto">Thanks<br>
<br>
but still stumbling (using 2.3.2)<br>
gdalwarp -cutline "PG:dbname=gisdb" -csql 'select * from polytest where id=1' -crop_to_cutline -of GTiff -srcnodata -9999 -dstnodata -9999 "PG:<connectinfo> schema=a table=rastertable" dest.tif <br>
<br>
returns:<br>
ERROR 1: Input file <rastertable> has no raster bands.<br>
<br>
gdalinfo reports that the table is tiled in 360 pieces which potentially is the source for the issue:<br>
<span style="color:#000000;font-family:Menlo;font-size: 11px">Subdatasets:</span><span style="font-size: 11px"><br>
</span><span style="color:#000000;font-family:Menlo;font-size: 11px"> SUBDATASET_1_NAME=PG:host=</span><span style="font-size: 11px"><br>
</span><span style="font-size: 11px"><br>
</span><span style="color:#000000;font-family:Menlo;font-size: 11px">SUBDATASET_360_DESC=PostGIS Raster at </span><span style="font-size: 11px"><br>
</span></div>
</div>
<div name="messageSignatureSection"><br>
<div class="matchFont">Hälsningar<br>
<br>
Andreas Oxenstierna<br>
T-Kartor Geospatial AB<br>
Olof Mohlins väg 12 Kristianstad<br>
mobile: +46 733 206831<br>
mailto: <a href="mailto:andreas.oxenstierna@t-kartor.com">andreas.oxenstierna@t-kartor.com</a><br>
<a href="http://www.t-kartor.com">www.t-kartor.com</a></div>
</div>
<div name="messageReplySection">On 10 May 2021, 19:31 +0200, Even Rouault <even.rouault@spatialys.com>, wrote:<br>
<blockquote type="cite" style="border-left-color: grey; border-left-width: thin; border-left-style: solid; margin: 5px 5px;padding-left: 10px;">
<p>Try with gdalwarp and the -cutline family of arguments<br>
</p>
<div class="moz-cite-prefix">Le 10/05/2021 à 19:23, Andreas Oxenstierna a écrit :<br>
</div>
<blockquote type="cite" cite="mid:cceedf40-d007-4ca8-a08f-d92ac9300466@Spark">
<div name="messageBodySection">
<div dir="auto">Hi list<br>
<br>
Is it possible to clip a PostGIS raster with a PostGIS vector poly using gdal_translate?<br>
<br>
I cannot find a working syntax to define the clipping table in the WHERE clause.<br>
Eg. this returns "<span>Error browsing database for PostGIS Raster properties : ERROR: syntax error at or near "FROM"</span><span><br>
</span><span><br>
</span>gdal_translate -of GTiff "PG:<connectinfo> schema=a table=rastertable WHERE='ST_Intersects(rast,c.geom) AND <a href="http://c.id" target="_blank" moz-do-not-send="true">c.id</a> = 2 FROM a.vectortable c'" a.tif</div>
</div>
<div name="messageSignatureSection"><br>
<div class="matchFont">Best regards<br>
<br>
Andreas Oxenstierna<br>
T-Kartor Geospatial AB<br>
Olof Mohlins väg 12 Kristianstad<br>
mobile: +46 733 206831<br>
mailto: <a href="mailto:andreas.oxenstierna@t-kartor.com" moz-do-not-send="true">
andreas.oxenstierna@t-kartor.com</a><br>
<a href="http://www.t-kartor.com" moz-do-not-send="true">www.t-kartor.com</a></div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</blockquote>
</div>
</blockquote>
</div>
</body>
</html>