2

I loaded a tif-file of some soil data into postgres with:

raster2pgsql -c -I -F -C -r -M -s 31467 -t 200x200 soil_file.tif gis.soil_map | psql -U user -d database -h localhost -p 5432

which worked perfectly fine. The tif itself shows data when imported in QGIS and also the the imported raster from my database shows its values in QGIS.

Here my problem:
But when I want to query my raster within my database the query is always empty:

SELECT rid, (ST_SummaryStats(rast, 1)).*  from gis.soil_map

enter image description here

and I have absolutely no idea what could cause this. The same procedure work fine with a different raster from a different source, so I think this might have to do with the file, but as I said, no idea what to look for.

  • How many bands does your data have? Because the form of the function you have used suggests you are only interested in band 1. Is this correct? – John Powell May 20 at 8:36
  • yes, they all have one band, they are no satellite images or something, but statical values in raster form. At the moment I think, that Postgres cannot handle the float64 files properly, so I try to save them with less precision – Julius Diel May 20 at 11:35
0

Yes, so the problem was, that the file was of type float64 and Postgres can't handle this (or at least my server). After I converted the image to float32, Summary stats and everthing can be computed.

I used GDAL.translate as it is implented in QGIS.

Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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