I can't load a georeferenced/skewed raster in QGIS if it is stored in a PostGIS database.

Problem Details
For some reasons, I need to create a skewed raster in a PostGIS database, and use it in my custom application. Firstly, I can create a raster in PostGIS like this:

create table grids(
    rid serial primary key, 
    rdata raster
create index idx_grids on grids using gist(ST_ConvexHull(rdata));

-- Parameters: width, height, upperleft-x, upperleft-y, scale-x, scale-y (almost always negative), skew-x, skew-y, EPSG
insert into grids(rid,rdata)
values (1, ST_MakeEmptyRaster(1000,2000,690000.5,4299999.5,12.5*sqrt(2),-6.25*sqrt(2),-6.25*sqrt(2),-12.5*sqrt(2),4509)

update grids
set rdata=ST_AddBand(rdata, '32BSI'::text, 128)
where rid=1;

It should produce a raster that's square, but rotated by 45 degrees.
Then, I could draw a small rectangle by using ST_SetValues:

update grids set rdata=ST_SetValues(rdata,1,200,200,50,50,255)

But when I load the raster into QGIS, the raster is shown upright rather than skewed.
I'm using QGIS 3.14.16 and PostgreSQL 12/PostGIS 3.0 under Windows 10 2004.
Is that the limitation of QGIS itself or its underlying libraries like GDAL? Or if there's anything wrong with my SQL syntax?

1 Answer 1


It seems that QGIS doesn't support showing skewed rasters by their original form (see display of raster in QGIS - cells are not rotated). This is an internal problem which can only be fixed at coding level by the developers. No progress is made as of November 2020.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.