Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
I actually solved the problem by reinstalling Postgres & PostGIS with the homebrew installation (here [link] (lukeberndt.com/2011/postgres-postgis-on-osx-lion)). No idea why Postegres.app didn't work for the raster... –  Francesco Feb 13 '13 at 8:41

2 Answers 2

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.

share|improve this answer

Postgresapp's tools are in a different location - /Applications/Postgres.app/Contents/Versions/9.3/. To use a given tool, prepend the full path:

/Applications/Postgres.app/Contents/Versions/9.3/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

Alternatively, add the directory to your PATH or use alias:

alias raster2pgsql="/Applications/Postgres.app/Contents/Versions/9.3/bin/raster2pgsql"

For permanency, add that line to your .bashrc file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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