-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 raster with QGIS 3.12.3 crashes #36689
Comments
FWIW per @jgrocha suggestion, I tried this command using the QGIS shell.
And that seems to work fine gives output like below - subdataset repeated for each row
|
I also tried dragging the layer from DBManager, but just highlighting the raster layer triggers this error: An error has occurred while executing Python code: - this one looks like it might be an issue with PG13 though as it seems to get stuck at the trying to get the version number.
I'll try reloading my dataset on PG12 and see if it works |
Okay tried reloading my data in PG12 (I'm using PostGIS 3.1.0dev (but doubt that matters)) and still get crashing when loading this layer in all 3 modes via - Browser - expanding db and selecting the layer and via DbManager -> selecting the layer and dragging. Only difference is that it errors after I drag the layer (not before as in when I had the database PG13beta1 )
|
Thank you for the report @robe2 I just did a quick test with QGIS Master/GDAL 3.2. I've used both PG11/PG12/PostGIS2.5/PostGIS3 and the result is the same. There were no crashes, but there are issues with the rendering. Playing with the tile size changes the rendering, but is is always messed.
Print screenI'm attaching a print screen, with the original raster loaded from tif. On the right, is the same raster |
seems a regression as no crash (or problems in rendering) on 3.10. |
I tried against my PG 12.3, GDAL 3.0.4, PostGIS 3.0.1 database POSTGIS="3.0.1 3.0.1" [EXTENSION] PGSQL="120" GEOS="3.8.0-CAPI-1.13.1 " PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 2.4.4, released 2020/01/08" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.4.3 (Internal)" TOPOLOGY RASTER PostgreSQL 12.3, compiled by Visual C++ build 1914, 64-bit and still get a crash. @jgrocha could it be maybe an issue that's been fixed since 3.12.3 was released? I'm using this installer - https://qgis.org/downloads/QGIS-OSGeo4W-3.12.3-1-Setup-x86_64.exe
|
Just retried in 3.10.6 to confirm it works and looks fine. This is what I get in QGIS 3.10.6 so definitely a regression @jgrocha one thing I didn't try which I realize might be why you are not getting the crash (I'll try that next on 3.12.3). It looks like you only loaded one file. I loaded all 12 files (so there are 12 tiles for each area where as yours would only have one). I'm going to try that next to see if the fact I've got overlapping rasters is causing the discrepancy between our experiences) |
@jgrocha okay it does seem to be the extra overlapping tiles. If I do similar to what you did just loading the first file QGIS 3.12.3 doesn't crash but gives me a screwed up image, similar to what you mentioned I would have expected the elev I have (which is just one file) to have at least displayed, but that crashes as well. https://biogeo.ucdavis.edu/data/worldclim/v2.1/base/wc2.1_10m_elev.zip And again displays and looks fine in QGIS 3.10.6 |
This fix has been backported only to 3.12, maybe is related |
I've found the issue (PR is coming) but I'm struggling with the band statistics (max value) here I get 2381
while GDAL gives me a very different value:
I know GDAL probably uses a sample but still I don't expect such a wide difference. Any idea? |
Ok, I see what's probably happening here GDAL uses a single tile (randomly?) to extract the statistics, in my case the tile comes from wc2.1_10m_prec_02.tif. QGIS native implementation does not support multiple tiles covering the same extent unless you set a subset string filter (or a temporal filter). |
Ah, in case of overlapping data, the result will depend on the order into which PostgreSQL returns rows intersecting the spatial result. The last returned tile will likely appear on-top. So yes, result might be somewhat "random" |
Nice work @elpaso |
…test PG raster: tests and data for issue #36689
Describe the bug
QGIS crashes when loading PostGIS raster layer. This same exercise works fine in QGIS 3.10.6
FWIW I'm running PostgreSQL 13 beta1 so might be related.
I'm going to do some more tests to make sure my newer PG is not the culprit and it's not a GDAL bug
How to Reproduce
I loaded data from here - http://biogeo.ucdavis.edu/data/worldclim/v2.1/base/wc2.1_10m_prec.zip
Using command
raster2pgsql -s 4326 -I -C -M prec/*.tif -F -t 256x256 ch12.prec | psql
QGIS and OS versions
Get below error
Crash ID: 8db542d910c169105d910e7e9ec58abf67aed639
Stack Trace
memcpy_repmovs memcpy.asm:114
GDALCopyWords64 :
MEMRasterBand::IRasterIO :
GDALRasterBand::RasterIO :
GDALRasterIO :
QgsPostgresRasterProvider::readBlock qgspostgresrasterprovider.cpp:455
QgsRasterDataProvider::block qgsrasterdataprovider.cpp:201
QgsSingleBandGrayRenderer::block qgssinglebandgrayrenderer.cpp:91
QgsBrightnessContrastFilter::block qgsbrightnesscontrastfilter.cpp:118
QgsHueSaturationFilter::block qgshuesaturationfilter.cpp:123
QgsRasterResampleFilter::block qgsrasterresamplefilter.cpp:162
QgsRasterProjector::block qgsrasterprojector.cpp:885
QgsRasterIterator::readNextRasterPartInternal qgsrasteriterator.cpp:130
QgsRasterDrawer::draw qgsrasterdrawer.cpp:60
QgsRasterLayerRenderer::render qgsrasterlayerrenderer.cpp:272
QgsMapRendererParallelJob::renderLayerStatic qgsmaprendererparalleljob.cpp:353
QtConcurrent::MapKernel::iterator,QtConcurrent::FunctionWrapper1 >::runIteration qtconcurrentmapkernel.h:69
QtConcurrent::MapKernel::iterator,QgsImageOperation::ProcessBlockUsingPixelOperation >::runIterations qtconcurrentmapkernel.h:78
QtConcurrent::IterateKernel::iterator,void>::forThreadFunction qtconcurrentiteratekernel.h:256
QtConcurrent::ThreadEngineBase::run :
QThreadPoolPrivate::reset :
QThread::start :
BaseThreadInitThunk :
RtlUserThreadStart :
QGIS Info
QGIS Version: 3.12.3-Bucure?ti
QGIS code revision: 8234261
Compiled against Qt: 5.11.2
Running against Qt: 5.11.2
Compiled against GDAL: 3.0.4
Running against GDAL: 3.0.4
Additional context
The text was updated successfully, but these errors were encountered: