I have done that many times and it usually works but I'm facing a problem now that I do not understand. I'm trying to load a raster (.tif) with a EPSG4326 and it is a one band file in my database from the windows command prompt. I use the following function:

raster2pgsql -s 4326 -I -C -M -R climat.tif -F -t 25x25 clim.climat | psql -h localhost -U postgres -d biotic_interactions

it seems at first glance that it is working as I get 0 and 1 inserted and that my new table appears in pgAdmin. However, when I open it in QGIS and I confront the table that I just imported to the initial raster I see the value of the pixels are not the same than in the original file. Also, I noticed that while importing the raster, I get a few NOTICE:

return error message: numeric field overflow unable to add constraint: nodata_values unable to add constraint: enforce_nodata_values_Rast

I'm using PostgreSQL 9.4.

  • could you add some details about that .tif? e.g. data type, range of values and especially the nodata value. the cast to NUMERIC type of the nodata values will most likely be the reason - check comments here for a quick explanation. – ThingumaBob Mar 15 '18 at 11:37
  • actually it is a .adf file but I clipped it in .tif (the problem remains in both formats). the data are integer (each pixel value is correspond to a category of climat/environment) ranging from 1 to 125 (integer values). Nodatavalue=255. I've seen the post you suggested but removing -C does not solve my issue. type=byte. – user3016665 Mar 15 '18 at 13:46

Your Answer

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

Browse other questions tagged or ask your own question.