When using the upload zipfile to geodatabase function of geodata, the shell command for unzipping the file works, but the shell command for shap2sql does not. it is appearently hanging for some reason, when I use the code:
"c:\progra~1\postgresql\8.3\bin\shp2pgsql.exe" -s 4326 -W ISO-8859-1 -g geom -I -c sites\default\files\temp\49185e3f8147c\simple_line.shp simple_line | c:\progra~1\postgresql\8.3\bin\psql.exe -h localhost -U mapper geodata
and paste it to dos, it asks me for the password for user mapper. then when I enter it it tells me it cannot find any of the files
I think that:
- The password is not addressed and needs to be
- That the full path to the file, not relative to drupal should be used for this shell command
there are several ways to stop it asking from passwords, including the PGPASS environment variable, tne .pgpass file and
setting the user as trust in the config. perhaps that is something you are already doing?
Just as a test I hacked in the hard path to the sahpefiles on line 581 of geodata module it looks like this:
$cmd = strtr('"%postgresql_bin/shp2pgsql%exe" -s %srid -W ISO-8859-1 -g geom -I -c C:\Progra~1\Apache~1\Apache2.2\htdocs\SPARCS\%shapefile %table | %postgresql_bin/psql%exe -h %host %port_option -U %user %database'
and tested again, it still hung, but when I tried it in dos, it worked, but required a manual password entry.
Next I addded this line to my pgpass.conf:
localhost:*:geodata:mapper:mapper
This solves the problem in a shell prompt but not from within the geodata module.
Next I hacked in this line:
putenv("PGPASS=mapper");
just before line 581, It did not work, but it might be in bad place. Setting the pgpass environemnt variable supposedly helps, but it is a deprecated solution so I dont know....
Any thoughts?
Hope this helps.....
Comments
Comment #1
jpulles commentedThe upload of shape files can indeed hang when uploading. Possible reasons:
- the password is needed; unfortunately psql doesn't accept a command parameter for the password, or
- an error in the command because e.g. the table already exists
The pgpass.conf (under Windows) can work but must be available for the web user instead of the console user. To be able to find this I once used under windows the following environment variables:
In the USERPROFILE, I used the user for which the pgpass.conf was defined in "C:\Documents and Settings\Geolab\Application Data\postgresql". I'm not sure if the alternative of "C:\Documents and Settings\All Users\Application Data\postgresql\pgpass.conf" works for all users.
If you are trying this, it helps to turn logging on: see the admin page ?q=admin/mappingkit/general.
Hope this helps,
John.
Comment #2
spydmobile commentedHmm, ok, what about using a dediated user with no password, is that a viable solution?
F
Comment #3
jpulles commentedI don't know if a user without a password is allowed, but you can at least change pg_hba.conf with a line :
host all mapper 127.0.0.1/32 trust