[gdal-dev] gdal raster clip - need some help

Even Rouault even.rouault at spatialys.com
Wed Sep 17 12:49:14 PDT 2025


Hi Scott,

please file a GH issue about that. The PGRaster indeed kicks in here.   
gdalwarp doesn't have that issue as it only uses vector drivers for the 
cutline whereas gdal raster clip allows both raster & vector drivers. In 
the mean time you should be able to work around the issue by adding 
"--config GDAL_SKIP=PostGISRaster"

Even

Le 17/09/2025 à 20:06, Scott via gdal-dev a écrit :
> I'm trying to clip a raster with a vector data source:
>
> gdal raster clip \
>    --input=raster.tif \
>    --like="PG:dbname=mydb" --like-sql="select geom from vector_table" \
>    --output=clipped.tif --overwrite --progress
>
> It gives me the error:
> ERROR 1: clip: Cannot get extent from clip dataset
>
> If I use a .gpkg in --like, it works fine.
>
> gdalwarp works fine with the same raster and same PG vector table:
>
> gdalwarp -cutline PG:dbname=mydb -csql "select geom from vector_table" 
> raster.tif clipped.tif
>
> If I modify the connection string to:
> --like="PG:mydb table=vector_table"
>
> It seems to think it's a raster table:
>
> Creating tile for bbox -12980000,3850000,-12970000,3860000
> Warning 1: Cannot find information about public.vector_table table in 
> raster_columns view. The raster table load would take a lot of time. 
> Please, execute AddRasterConstraints PostGIS function to register this 
> table as raster table in raster_columns view. This will save a lot of 
> time.
> ERROR 1: Error browsing database for PostGIS Raster properties : 
> ERROR: column "rast" does not exist
> LINE 1: ...m) as ymax, scale_x, scale_y from (select st_srid("rast") 
> sr...
>
>
>
> Am I missing a key parameter here?
>
> Debian 12, GDAL 3.11.3
>
> Thanks!
> Scott
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list