I am trying to upload a large number of 3 band rasters to a PostGIS database using raster2pgsql on the command line in Windows 7. Here is my command:
raster2pgsql -I -C -s 27700 -F -t 100x100 -M F:\Filedirectory\myfile.tif mytablename | psql -h localhost -p 5942 -U postgres -d mydatabase
Sometimes (though increasingly rarely it seems) the upload works, sometimes I get the following message:
Processing 1/1: F:\Filedirectory\myfile.tif
ERROR 1: TIFFFillStrip:Integer overflow
ERROR 1: TIFFReadEncodedStrip() failed.
ERROR 1: F:\Filedirectory\myfile.tif , band 1:
IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
ERROR: rt_raster_from_gdal_dataset: Could not get data from GDAL raster
ERROR: convert_raster: Could not convert VRT dataset to PostGIS raster
ERROR: process_rasters: Could not process raster: F:\Filedirectory\myfile.tif
ERROR: Unable to process rasters
Other times I get a string of the usual INSERT 0 1 and then the same message comes up.
I have been unable to find an explanation for the meaning of this message, and I cannot find anything consistent between the files that fail and the ones that don't.
Does anyone know what this message means and how I can fix the problem?
1 Answer 1
The solution to this issue was to use ERDAS Imagine to convert the files to the .img format. They then worked with this command.
raster2pgsql -I -C -s 27700 -F -t 100x100 -M F:\Filedirectory\myfile.img mytablename | psql -h localhost -p 5942 -U postgres -d mydatabase
This error message appears to be something related to being unable to read tifs for some reason.