Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading PostGIS rasters do not work #16014

Closed
qgib opened this issue Dec 18, 2012 · 12 comments
Closed

Loading PostGIS rasters do not work #16014

qgib opened this issue Dec 18, 2012 · 12 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)

Comments

@qgib
Copy link
Contributor

qgib commented Dec 18, 2012

Author Name: Paolo Cavallini (@pcav)
Original Redmine Issue: 6889
Affected QGIS version: 3.6.0
Redmine category:rasters


While dropping a PostGIS raster to the canvas, everything works fine in

QGIS version 1.9.0-Master
QGIS code revision ef6da72
Compiled against Qt 4.8.2
Running against Qt 4.8.2
Compiled against GDAL/OGR 1.9.0
Running against GDAL/OGR 1.9.0
GEOS Version 3.3.3
PostgreSQL Client Version 9.1.6
SpatiaLite Version 3.1.0-RC2
QWT Version 5.2.2
PROJ.4 Version 470
QScintilla2 Version

while it is returning and error:

GDAL provider: File does not exist: PG: dbname=db_corso host=localhost user=corso
password=corso port=5432 mode=2 schema=public table=aspect

Raster layer: Provider is not valid (provider: gdal, URI: PG: dbname=db_corso
host=localhost user=corso password=corso port=5432 mode=2 schema=public table=aspect

in:

Revisione codice QGIS 489a9d5

all same libs, except for Versione QWT 6.0.0-svn


@qgib
Copy link
Contributor Author

qgib commented Mar 4, 2015

Author Name: Antonio Locandro (Antonio Locandro)


Today it happened to me, if I drag and drop from DB Manager I get the following error, if I use the add to canvas option it works fine

Using Windows 7 QGIS version 2.8.1-Wien 32 - bit

@qgib
Copy link
Contributor Author

qgib commented Mar 4, 2015

Author Name: Antonio Locandro (Antonio Locandro)


here is the file


  • 8481 was configured as raster_drag_drop.png

@qgib
Copy link
Contributor Author

qgib commented May 29, 2015

Author Name: Paolo Cavallini (@pcav)


In my case (master on Debian), I can add it via D&D, not with Add to canvas.
The issue merits some deeper inspection.

@qgib
Copy link
Contributor Author

qgib commented Jun 2, 2015

Author Name: Salvatore Larosa (@slarosa)


This should be fixed in both master and release-2_8 branch.
Please reopen if necessary.


  • resolution was changed from to fixed/implemented
  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented Jun 2, 2015

Author Name: Paolo Cavallini (@pcav)


Still not working here (current master on Debian sid):

GDAL provider: Cannot get GDAL raster band:
(src/providers/gdal/qgsgdalprovider.cpp : 2521 : initBaseDataset)
Raster layer: Provider is not valid (provider: gdal, URI: PG: dbname=curso host=localhost user=util password=util port=5432 mode=2 schema=gis column=rast table=clip_hdr
(src/core/raster/qgsrasterlayer.cpp : 668 : setDataProvider)

AFAICT, this happens only for rasters without a primary key.

In addition, -R raster crash QGIS (I think this is another ticket).

src/providers/gdal/qgsgdalprovider.cpp: 2334: (bandStatistics) [0ms] theStats = 1 supportedStats = 110111
src/providers/gdal/qgsgdalprovider.cpp: 2343: (bandStatistics) [0ms] Using GDAL statistics.
src/providers/gdal/qgsgdalprovider.cpp: 2359: (bandStatistics) [0ms] bApproxOK = 1
Segfault


  • resolution was changed from fixed/implemented to
  • status_id was changed from Closed to Reopened

@qgib
Copy link
Contributor Author

qgib commented Jun 2, 2015

Author Name: Salvatore Larosa (@slarosa)


ok, I now got it.

I am not sure if that is only due whether the primary key exist or not.
The following is a testcase with stacktrace:

-- create an empty table
CREATE TABLE public.test_raster
(
  rid integer,
  rast raster,
  CONSTRAINT enforce_height_rast CHECK (st_height(rast) = ANY (ARRAY[100, 24])),
  CONSTRAINT enforce_width_rast CHECK (st_width(rast) = ANY (ARRAY[100, 24])),
  CONSTRAINT enforce_srid_rast CHECK (st_srid(rast) = 4326)
);

-- create an empty raster
INSERT INTO test_raster(rid,rast)
VALUES(1, ST_MakeEmptyRaster( 100, 100, 0.0005, 0.0005, 1, 1, 0, 0, 4326) );

-- add primary key
ALTER TABLE test_raster ADD CONSTRAINT test_pkey PRIMARY KEY (rid);

stacktrace:

ERROR 5: GDALWarpOptions.Validate()
  nBandCount=0, no bands configured!

Program received signal SIGSEGV, Segmentation fault.
VRTWarpedDataset::CloseDependentDatasets (this=this@entry=0x2daf140) at vrtwarped.cpp:346
346	        if( psWO->hSrcDS != NULL )
(gdb) bt
#0  VRTWarpedDataset::CloseDependentDatasets (this=this@entry=0x2daf140) at vrtwarped.cpp:346
#_1  0x00007ffff553f634 in VRTWarpedDataset::~VRTWarpedDataset (this=0x2daf140, __in_chrg=<optimized out>) at vrtwarped.cpp:297
#_2  0x00007ffff553f669 in VRTWarpedDataset::~VRTWarpedDataset (this=0x2daf140, __in_chrg=<optimized out>) at vrtwarped.cpp:298
#_3  0x00007ffff555b30f in GDALClose (hDS=0x2daf140) at gdaldataset.cpp:2512
#_4  0x00007fff92ea0996 in QgsGdalProvider::initBaseDataset (this=0x2da53f0)
    at /home/sam/pacchetti_gis/QGIS/src/providers/gdal/qgsgdalprovider.cpp:2526
#_5  0x00007fff92e913a7 in QgsGdalProvider::QgsGdalProvider (this=0x2da53f0, uri=..., update=false)
    at /home/sam/pacchetti_gis/QGIS/src/providers/gdal/qgsgdalprovider.cpp:164
#_6  0x00007fff92e9c60e in classFactory (uri=0x2d73d78) at /home/sam/pacchetti_gis/QGIS/src/providers/gdal/qgsgdalprovider.cpp:1893
#_7  0x00007ffff493c8b0 in QgsProviderRegistry::provider (this=0x15fd2a0, providerKey=..., dataSource=...)
    at /home/sam/pacchetti_gis/QGIS/src/core/qgsproviderregistry.cpp:382
#_8  0x00007ffff4ae126f in QgsRasterLayer::setDataProvider (this=0x2d73d40, provider=...)
    at /home/sam/pacchetti_gis/QGIS/src/core/raster/qgsrasterlayer.cpp:654
#_9  0x00007ffff4addeac in QgsRasterLayer::QgsRasterLayer (this=0x2d73d40, uri=..., baseName=..., providerKey=..., loadDefaultStyleFlag=true)
    at /home/sam/pacchetti_gis/QGIS/src/core/raster/qgsrasterlayer.cpp:136
#_10 0x00000000005210d7 in QgisApp::addRasterLayerPrivate (this=0x1178810, uri=..., baseName=..., providerKey=..., guiWarning=true, guiUpdate=true)
    at /home/sam/pacchetti_gis/QGIS/src/app/qgisapp.cpp:9721
#_11 0x0000000000521666 in QgisApp::addRasterLayer (this=0x1178810, uri=..., baseName=..., providerKey=...)
    at /home/sam/pacchetti_gis/QGIS/src/app/qgisapp.cpp:9808
#_12 0x00000000004e115f in QgisApp::dropEvent (this=0x1178810, event=0x7fffffffa690) at /home/sam/pacchetti_gis/QGIS/src/app/qgisapp.cpp:1065
#_13 0x00007ffff20fc02e in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_14 0x00007ffff24c021b in QMainWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_15 0x00000000004e13ec in QgisApp::event (this=0x1178810, event=0x7fffffffa690) at /home/sam/pacchetti_gis/QGIS/src/app/qgisapp.cpp:1097
#_16 0x00007ffff20ac70c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_17 0x00007ffff20b1533 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_18 0x00007ffff479cb16 in QgsApplication::notify (this=0x7fffffffd890, receiver=0x13f2a30, event=0x7fffffffa690)
    at /home/sam/pacchetti_gis/QGIS/src/core/qgsapplication.cpp:253
#_19 0x00007ffff2d02b5e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_20 0x00007ffff21312c1 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4


@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


  • easy_fix was configured as 0
  • regression was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Feb 24, 2018

Author Name: Paolo Cavallini (@pcav)


Not tested on Q3 because I can no longer load pgrasters.


  • description was changed from While dropping a PostGIS raster to the canvas, everything works fine in

QGIS version 1.9.0-Master
QGIS code revision ef6da72
Compiled against Qt 4.8.2
Running against Qt 4.8.2
Compiled against GDAL/OGR 1.9.0
Running against GDAL/OGR 1.9.0
GEOS Version 3.3.3
PostgreSQL Client Version 9.1.6
SpatiaLite Version 3.1.0-RC2
QWT Version 5.2.2
PROJ.4 Version 470
QScintilla2 Version

while it is returning and error:

GDAL provider: File does not exist: PG: dbname=db_corso host=localhost user=corso
password=corso port=5432 mode=2 schema=public table=aspect

Raster layer: Provider is not valid (provider: gdal, URI: PG: dbname=db_corso
host=localhost user=corso password=corso port=5432 mode=2 schema=public table=aspect

in:

Revisione codice QGIS 489a9d5

all same libs, except for Versione QWT 6.0.0-svn to While dropping a PostGIS raster to the canvas, everything works fine in

QGIS version 1.9.0-Master
QGIS code revision ef6da72
Compiled against Qt 4.8.2
Running against Qt 4.8.2
Compiled against GDAL/OGR 1.9.0
Running against GDAL/OGR 1.9.0
GEOS Version 3.3.3
PostgreSQL Client Version 9.1.6
SpatiaLite Version 3.1.0-RC2
QWT Version 5.2.2
PROJ.4 Version 470
QScintilla2 Version

while it is returning and error:

GDAL provider: File does not exist: PG: dbname=db_corso host=localhost user=corso
password=corso port=5432 mode=2 schema=public table=aspect

Raster layer: Provider is not valid (provider: gdal, URI: PG: dbname=db_corso
host=localhost user=corso password=corso port=5432 mode=2 schema=public table=aspect

in:

Revisione codice QGIS 489a9d5

all same libs, except for Versione QWT 6.0.0-svn

@qgib
Copy link
Contributor Author

qgib commented Mar 9, 2019

Author Name: Giovanni Manghi (@gioman)


End of life notice: QGIS 2.18 LTR
*
Source:*
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/


  • status_id was changed from Reopened to Closed
  • resolution was changed from to end of life

@qgib
Copy link
Contributor Author

qgib commented Mar 9, 2019

Author Name: Paolo Cavallini (@pcav)


  • status_id was changed from Closed to Open
  • version was changed from master to 3.6.0
  • resolution was changed from end of life to

@qgib
Copy link
Contributor Author

qgib commented Apr 14, 2019

Author Name: Giovanni Manghi (@gioman)


I was able to add postgis rasters from DB manager without any issue in 3.6.1/Ubuntu and Windows. Please try and leave feedback.


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Apr 15, 2019

Author Name: Paolo Cavallini (@pcav)


Confirmed, it works on QGIS 3.4.
Thanks.


  • resolution was changed from to fixed/implemented
  • status_id was changed from Feedback to Closed

@qgib qgib closed this as completed Apr 15, 2019
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats) labels May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant