Here is a possibility (which is what I do):
1) for the sake of convenience, create symlinks in /usr/local/bin/ as a root:
# ln -s /usr/lib/postgresql/8.4/bin/shp2pgsql /usr/local/bin/shp2pgsql
# ln -s /usr/lib/postgresql/8.4/bin/raster2pgsql /usr/local/bin/raster2pgsql
# ln -s /usr/lib/postgresql/8.4/bin/pgsql2shp /usr/local/bin/pgsql2shp
It will allow you to call the 3 commands from any folder.
2) Create a new data base user, as postgres root:
# su postgres
# psql -d template1 -c "ALTER USER dbuser WITH PASSWORD 'dbpwd'"
3) If you want to be able to use the db without the need to type passwords
(very handy to script things), you can create a file .pgpass in your home,
with just this line:
localhost:5432:*:dbuser:dbpwd
And then give it the minimum permissions:
chmod 600 .pgpass
4) Now test the connection, from any user:
psql -h localhost -d yourdb -U dbuser -c 'SELECT current_date;'
This should work! If you don't want to use step 3 (no password), just add a
-W in the command, if I'm not mistaken.
Hope this helps,
Mathieu.
Le 09/03/2012 08:34, aperi2007 a écrit :
>Yes, raster2pgsql is in this folder. So i go through the terminal to
>this folder and run something like that: raster2pgsql -s 4236 -I -C -M
>*.tif -F -t 100x100 public.test > out.sql
>
>Before that, i go to the pgAdminIII, connect to the localhost and >create
a new database "testing" with template "template_postgis".
>
>
>How do i declare in the command line that the database that i want to
>load the image is the new one i just created?
>
>What i get running the command below is: "out.sql: Permission denied".
>
>What is wrong with this process or what i forget to do?
I will have the same trouble.
After same tests I found that the creation and load of postgis rasters
work only with the "postgres" account.
Otherwise it return me the same your "permission denied".
Andrea.
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
--
~$ whoami
Mathieu Basille, Post-Doc
~$ locate
Laboratoire d'Écologie Comportementale et de Conservation de la Faune
+ Centre d'Étude de la Forêt
Département de Biologie
Université Laval, Québec
~$ info
http://ase-research.org/basille
~$ fortune
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users