[GIS] Stuck in loading raster to PostGIS

postgispostgresqlraster

I am running running Mac OS X (10.7.5), PostgreSQL (9.2) and PostGIS (2.0.2) (installed via Postgres.app).

The PostGIS extension seems to work perfectly with vector and raster layers. Once I enable PostGIS for the specific database I am able to create vector and rasters from the SQL Editor of phpAdmin3 (like with ST_MakeEmptyRaster).

The problems begin when I try to load a raster with raster2pgsql. I have no great experience with Postgres (or DBMS in general) so what I did might appear stupid…

I tried to launch it via psql following this steps:

1) Open psql terminal;

2) typed \c mydatabase;

3) Got as prompt mydatabase=# (that I guess means I am logged with owner rights…;

4) Now I tried raster2pgsql -Gbut of course is no SQL so I got ERROR: syntax error at or near "raster2pgsql" LINE 1: raster2pgsql -G;

Then I went back to my Mac OS X terminal shell and into the the folder where my raster2pgsql file is located (/usr/local/pgsql/bin) and typed raster2pgsql -s 4236 -I -C -M *.tif -F -t 100x100 /my/path/to/the/file/myfile.tif myrastertable | psql -U myuser -d mydb -h localhost -p 5432 but I got -bash: raster2pgsql: command not found.

What I am doing wrong?

Best Answer

In Windows, the raster2pgsql file is in

C:\Program Files (x86)\PostgreSQL\9.1\bin>raster2pgsql 

In Linux, it's in

/usr/bin (ubuntu)  

In OSX, I have no idea, but have you tried to search it? And yes, that fifth way was the right way.