I'm trying to download a raster into postgres/postgis.

So far I wrote:

raster2pgsql -s 3006 -I -C -M -R filename.tif -F -t 463.313x463.313 schema.rastername | psql -h localhost -U postgres -d db

The raster is dowload that way successfully but my problem comes with the fact that the output raster file (once download read in postgres) is smaller than the original one.

My raster has 2960rowsx2558columns, each pixel has 463.313x463.313 for dimension, and I have a scale factor of 1.

I don't understand how to specify the dimensions. I have read these posts "Difference in raster size using raster2pgsq" and "Loading a raster into a PostGIS 2.0 database on Windows" but I did not get how the conversion is done.


Values for -t is not the pixel scale dimensions but rather the number of pixels in each tile. So, -t 100x100 would generate tiles where each tile would be at most be 100x100 pixels in size.

| improve this answer | |
  • I'm not sure I got you, neither to know what a tile is. Is the tile the same as the raster? In the output, I want to get a file that understand each pixel value of a dimension of 463.313x463.313 as a unit. How would I transform the pixel dimension into tile size? – user3016665 Feb 12 '14 at 8:27
  • If the raster was broken down into smaller rectangles, each rectangle would be a tile. Hence why the values for the -t parameter is in the number pixels width and height. The value 463.313x463.313 is not the dimension but rather the scale of the each pixel. What this means for SRID 3006 is that each pixel's width and height is equivalent to 463.313 metres on Earth's surface. – dustymugs Feb 21 '14 at 23:26

I figured out the problem, probably my question was wrongly formulated then. Any way, specifying a tile -t bigger than the actual pixel size does not induce a lost of information contained in each pixel but it is a way to specify how to process the information included in the raster. In other words, when doing a request based on the raster it looks for the information first according to tile division of the raster (which represents less work to do because there are less tiles than pixels) and once the tiles of interest are localized, it looks for the pixels that match the request within the selected tiles. It is a way to process the information more efficiently than to go through all pixels from the beginning. Thus it hierarchically looks for the information requested.

| improve this answer | |

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.