7

Following on from my attempt to install a postgresql 9.1 db with postgis 2.0 on windows 7, I am trying to figure out how to load a raster. I have successfully loaded a shapefile, and am trying to do the same with a .tif file using the Load Raster to PostGIS plugin (version 0.5.1) in QGIS (version 1.7). I have set up the connection to my db, and am using the following settings:

enter image description here

When I click on the OK button, I get the below error message. I've tried this with a .adf file and also a .tif file, both projected in Albert Equal Area Conic with an SRID of 102003.

Checking parameters...
Connecting to database...
Storing overview 1 on database...
Failed.
Finished storing overview 1.
Storing overview 2 on database...
Failed.
Finished storing overview 2.
Storing overview 3 on database...
Failed.
Finished storing overview 3.
Finished.

This process has not inserted anything into my database, and I don't understand the error message. Some previous related questions are here (asked by me, using a different process on loading rasters) and here (using the same plugin but much earlier in the year).

3

celenius,

It's quite possible that the QGIS raster loader hasn't been revised yet to fit with the new changes we have in place. I suggest trying the raster2pgsql.exe packaged with the latest windows experimental. It should load tifs just fine.

Instructions here.

http://www.postgis.org/documentation/manual-svn/using_raster.xml.html#RT_Loading_Rasters

  • When I try loading running the program from the command line using this C:\Program Files (x86)\PostgreSQL\9.1\bin>raster2pgsql.exe -s 102003 -c -C F:\pop.tif > test.sql I get an Access is denied. message (not certain if I have to provide a schema or not). Is there a way I can run it as an administrator? When I right-click and choose the run as administrator option the screen just pops and disappears - I can't pass it any arguments. – djq Dec 21 '11 at 18:04
0

This command from Boundless. Has worked for me

raster2pgsql -I -C -s <SRID> <PATH> <SCHEMA>.<DBTABLE> | psql -d <DATABASE>

Where

<SRID> Spatial reference identifier e.g 4326 for WGS84 CRS

<PATH> Full path to the raster file (such as C:\MyData\land\landuse.tif)

<SCHEMA> Target schema where the new raster table will be created e.g public

<DBTABLE> New database table to be created (usually the same name as the source raster file)

<DATABASE> Target database where the table will be created

The -I option will create a spatial GiST index on the raster column after the table is created. This is strongly recommended for improved performance. The -C option will apply the raster constraints (SRID, pixel size and so on) to ensure the new raster table is correctly registered in the raster_columns view.

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