Bug report #21844

I get error message Invalid Layer When I add raster layer from DB_Manager in QGIS 3.4.6

Added by Navid Taheri 7 months ago. Updated 7 months ago.

Status:Feedback
Priority:Normal
Assignee:-
Category:DB Manager
Affected QGIS version:3.4.6 Regression?:No
Operating System:LMDE 3 (Debian 9) Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29659

Description

I downloaded two rasters from site: srtm.csi.cgiar.org/srtmdata/ after that I did import them to my PostgreSQL database
It seem those files imported without any problem I checked by SQL queries moreover I can add them without
any problem to my map through Layer > Add Layer > Add Raster Layer But when I want add them via DB_Manager or Layer > Add Layer > Add PostGIS Layers, I got error messages:

"Invalid Layer: GDAL provider Cannot open GDAL dataset PG: dbname='zigmamap' host=localhost user=postgres port=5432 mode=2 schema='public' column='rast' table='srtm_48_06': Couldn't establish a database connection Raster layer Provider is not valid (provider: gdal, URI: PG: dbname='zigmamap' host=localhost user=postgres port=5432 mode=2 schema='public' column='rast' table='srtm_48_06'"

error.png (412 KB) Navid Taheri, 2019-04-13 07:13 AM

History

#1 Updated by Giovanni Manghi 7 months ago

  • Status changed from Open to Feedback

I cannot confirm, downloaded a raster from the same source, loaded it in postgresql (used 9 and 10) with raster2pgsql and always been able to add it to qgis using the db manager (tested also on both Linux and Windows).

#2 Updated by Navid Taheri 7 months ago

Giovanni Manghi wrote:

I cannot confirm, downloaded a raster from the same source, loaded it in postgresql (used 9 and 10) with raster2pgsql and always been able to add it to qgis using the db manager (tested also on both Linux and Windows).

Thank you so much, I'm using PostgreSQL latest version (11.2) in LMDE 3 X64 but based on you answer I think this problem is not relate to postgresql, I did import rasters in many way based on raster2pgsql manual in Postgis.net,I'd many try even I tried with asc format, may I ask you write your command line you used for importing rasters? I will check again with your method
Thanks a bunch

#3 Updated by Giovanni Manghi 7 months ago

Navid Taheri wrote:

Giovanni Manghi wrote:

I cannot confirm, downloaded a raster from the same source, loaded it in postgresql (used 9 and 10) with raster2pgsql and always been able to add it to qgis using the db manager (tested also on both Linux and Windows).

Thank you so much, I'm using PostgreSQL latest version (11.2) in LMDE 3 X64 but based on you answer I think this problem is not relate to postgresql, I did import rasters in many way based on raster2pgsql manual in Postgis.net,I'd many try even I tried with asc format, may I ask you write your command line you used for importing rasters? I will check again with your method
Thanks a bunch

i.e.

raster2pgsql -s 4326 -I -M -C srtm_35_05.tif mdtteste > mdtteste.sql

then

sql -U teste -h localhost -f mdtteste.sql

#4 Updated by Navid Taheri 7 months ago

Giovanni Manghi wrote:

Navid Taheri wrote:

Giovanni Manghi wrote:

I cannot confirm, downloaded a raster from the same source, loaded it in postgresql (used 9 and 10) with raster2pgsql and always been able to add it to qgis using the db manager (tested also on both Linux and Windows).

Thank you so much, I'm using PostgreSQL latest version (11.2) in LMDE 3 X64 but based on you answer I think this problem is not relate to postgresql, I did import rasters in many way based on raster2pgsql manual in Postgis.net,I'd many try even I tried with asc format, may I ask you write your command line you used for importing rasters? I will check again with your method
Thanks a bunch

i.e.

raster2pgsql -s 4326 -I -M -C srtm_35_05.tif mdtteste > mdtteste.sql

then

sql -U teste -h localhost -f mdtteste.sql

Thank you much, I found out, When I select rater in DB_Manager and then right click on that and select add to Canvas option it's Ok It added without any error message add to my map without problem, But when I want add to Canvas via drag and drop I got that error I described earlier, I don't know why drag and drop and add PostGIS didn't work without any problem for me but it is not important I'll add my raster DB_Manager > Add To Canvas.

Thank you so much

#5 Updated by Giovanni Manghi 7 months ago

Thank you much, I found out, When I select rater in DB_Manager and then right click on that and select add to Canvas option it's Ok It added without any error message add to my map without problem, But when I want add to Canvas via drag and drop I got that error I described earlier, I don't know why drag and drop and add PostGIS didn't work without any problem for me but it is not important I'll add my raster DB_Manager > Add To Canvas.

Thank you so much

works ok for me with d&d, double click, and right click > add to canvas

#6 Updated by Navid Taheri 7 months ago

Giovanni Manghi wrote:

Thank you much, I found out, When I select rater in DB_Manager and then right click on that and select add to Canvas option it's Ok It added without any error message add to my map without problem, But when I want add to Canvas via drag and drop I got that error I described earlier, I don't know why drag and drop and add PostGIS didn't work without any problem for me but it is not important I'll add my raster DB_Manager > Add To Canvas.

Thank you so much

works ok for me with d&d, double click, and right click > add to canvas

I don't know why work for you perfect, I'd wish work for me like you but It didn't, but for only work DB_Manager > Add To Canvas, Is it possible because PostgreSQL version? I'm using PostgreSQL 11.2 (Debian 11.2-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit

#7 Updated by Giovanni Manghi 7 months ago

I don't know why work for you perfect, I'd wish work for me like you but It didn't, but for only work DB_Manager > Add To Canvas, Is it possible because PostgreSQL version? I'm using PostgreSQL 11.2 (Debian 11.2-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit

can you test on pgsql 9/10?

#8 Updated by Navid Taheri 7 months ago

Giovanni Manghi wrote:

I don't know why work for you perfect, I'd wish work for me like you but It didn't, but for only work DB_Manager > Add To Canvas, Is it possible because PostgreSQL version? I'm using PostgreSQL 11.2 (Debian 11.2-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit

can you test on pgsql 9/10?

No, No need thank you so much, If I'll be able add raster to map by add to canvas it is enough for me, I hope in new QGIS update it can be more compatible with postgresql latest version because postgresql is growing very fast.

Thank for taking your time ๐Ÿ™๐Ÿคž

#9 Updated by Paolo Cavallini 7 months ago

I don't think it's the pg version, It works smoothly for me on pg11

Also available in: Atom PDF