Loading a raster into a PostGIS 2.0 database on Windows

Celenius,

If you don't use the -t option with size dimensions, then your raster file will come in as a single record. I just noticed an error in the docs which is probably what's confusing you. I'll fix that. The -t should always be followed by a widthxheight.

If you want it to be chunked say in 100x100 pixel width height -- as Mapperz says -- use the -t option.

So your command would be:

raster2pgsql -s 102003  -t 100x100 ras_test.tif ras_test > elev.sql

Take a look at the aerial example in the docs. http://www.postgis.org/documentation/manual-svn/using_raster.xml.html#RT_Raster_Loader

Which is the one a lot of the manual examples use:

raster2pgsql -I -C -e -Y -F -s 26986 -t 128x128 -l 2,4 bostonaerials2008/*.jpg aerials.boston | psql -U postgres -d gisdb -h localhost -p 5432

I know the switches can be a bit daunting because their are so many and most are optional. Perhaps in 2.1 we'll have a gui similar to the shp2pgsql-gui to make this a bit simpler for newbies.

In the latest verson of raster2pgsql there is logic to infer the srid from the georeference info in the tif or other raster file (this version is available as window binary now). Haven't tried that feature yet, but if it works you can even leave out the srid and it will guess (hopefully correctly).


SRID? -s 4236 (required)

Are the arguments -I -C -M all optional?

-C Apply raster constraints -- srid, pixelsize etc. to ensure raster is properly registered in raster_columns view. (required)

-M (Vacuum analyze the raster table.) optional

-I (Create a GiST index on the raster column. ) optional but recommended

-t TILE_SIZE (Cut raster into tiles to be inserted one per table row. TILE_SIZE is expressed as WIDTHxHEIGHT.)

myschema.demelevation leave out (yes)

http://postgis.net/docs/using_raster_dataman.html#RT_Loading_Rasters