[postgis-users] QGIS Loads Black Screen For PostGIS Out-DbRaster Data

Regina Obe lr at pcorp.us
Sun Apr 23 13:56:21 PDT 2017

Couple of updates here:


The srid issue with the raster2pgsql transforming instead of setting srid, I confirmed to be an unintentional feature (bug however you want to think of it).


I've patched it up here:



I think this issue wasn't discovered because using the –Y (which means copy mode) is much more efficient than without –Y (which uses INSERT statements) and when you use the –Y, the system doesn't try to transform, and does do the correct set srid because the transform logic relies on ST_Transform which can't be done in copy mode.


So the work around for the broken versions is to use the –Y switch.  You should probably just always use the –Y switch when you don't need to transform, which you can't do very well with the broken version.


raster2pgsql -C -t 500x500 -R -Y -s 26918 -F -I C:/gisdata/*.jp2 nj_aerials


When I do that transform is not attempted and the rasters stay out of database, but the SRID is set to what I specified.


On a related note, I tested QGIS and ran into the same issue as Osahon that the out-db does not show.


However if I build overviews and select the out-db it shows until I zoom into the image.


I think this happens because zooming in forces it to use the out-db table instead of the overviews. I guess the driver is trying to use the raw bytes instead of using the built in raster functions for display.

Not sure how hard of a fix that would be to fix the GDAL postgis raster driver as I suspect it's the GDAL driver at fault and not QGIS.


Hope this helps,



From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Osahon Oduware
Sent: Wednesday, April 19, 2017 11:52 AM
To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Subject: Re: [postgis-users] QGIS Loads Black Screen For PostGIS Out-DbRaster Data


Hi Tumasgiu,

Sorry, for not updating you. Yes, I followed up on your suggestion and Regina, Adrian, and some others assisted me in building PostGIS with a MrSID-enabled GDAL. My Out-DB rasters are in the MrSID format.

This raster file exist on the filesystem and when it is loaded directly into QGIS it displays the image (aerial photo). Also, when the same file is stored in PostGIS as a raster (IN-DB), it can be viewed in QGIS (using the DB Manager tool). However, when I reference the same file as an OUT-DB raster in PostGIS (in this case only the metadata of the raster and the filepath to the raster file is stored), an attempt to view it in QGIS (using the DB Manager tool) results in a black image being displayed instead of the aerial photo.



On Wed, Apr 19, 2017 at 4:41 PM, Tumasgiu Rossini <rossini.t at gmail.com <mailto:rossini.t at gmail.com> > wrote:


What is the format of your rasters ?

With your precedents messages in mind, I guess that the format is Mr.SID,

can you confirm that ?

(if so, then it means that you have managed your first postgis build, so congrats !)

It's important to give as much as detail as possible if you want help.


2017-04-18 15:43 GMT+02:00 Osahon Oduware <osahon.gis at gmail.com <mailto:osahon.gis at gmail.com> >:

Hi All,


I have an out-db raster on PostGIS which I tried to load in QGIS (v 2.14.12-Essen) utilizing the DB Manager to establish a connection. I could view the raster table, but when I try to "Add to canvas" it displays a black screen instead of the raster image. 


I would be glad if someone could help me to resolve this.


postgis-users mailing list
postgis-users at lists.osgeo.org <mailto:postgis-users at lists.osgeo.org> 


postgis-users mailing list
postgis-users at lists.osgeo.org <mailto:postgis-users at lists.osgeo.org> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170423/f457e866/attachment.html>

More information about the postgis-users mailing list