1

I try to load rasters through raster2pgsql. I try to call it through pgAdmin command line, but when I call any raster2pgsql command (even raster2pgsql -G), it does nothing, I just get another line to write more commands. No output, no time doing something. Non-gdal psql commands work as expected. \raster2pgsql leads to "invalid command" error. I am new to the command line and psql, so I'm stuck here.

I have PostgreSQL 9.3.4, PostGIS 2.1.3 and pgAdmin III 1.18.1 on WIndows XP 32 bit. I made sure that raster2pgsql.exe is in its place in bin folder, but I don't know of other ways to validate whether it is installed properly.

2

You first mistake is trying to call it via pgAdmin command line. Just call it from dos screen.

What you could do is create a batch file like

load_data.bat

Then put lines like folliowing in there and then run the bat file

SET PATH="%PATH%;c:\Program files\PostgresSQL\9.3\bin"
SET PGPORT=5432
SET PGHOST=localhost
SET PGUSER=postgres
SET PGPASSWORD=whatever
raster2pgsql -I -e -F -C -Y -s 26986 -t 500x500  dems/*.tif noaa | psql -d yourdb
pause

Putting a pause will allow you to see what happens

  • It works for me only if I navigate to the bin folder of my PostgreSQL installation, otherwise it classifies raster2pgsql as an unknown command. Anyway, it works. – Pavel V. Aug 12 '14 at 12:22
  • Now it works; I have PGPATH variable containing the path to my PostgreSQL bin directory (it is on drive d on my PC), and then I changed the second-from-end row to: CALL %PGPATH%raster2pgsql... – Pavel V. Aug 13 '14 at 8:06

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.