| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 5 Mar 2010 16:32:46
|
Loretta_B-OB
New member
Joined: 28 Oct 2009 23:36:50
Messages: 9
Offline
|
I have installed Postgres Plus (postgresplus-8.4.1-2-linux-x64.bin) on a 64 bit machine running Ubuntu karmic. I then went to the /opt/PostgresPlus/8.4SS/bin directory and ran ./shp2pgsql. I get the following error:
./shp2pgsql: 13: ./shp2pgsql.bin: not found
So I put some echo statements in the shp2pgsql script and I find that the WD variable, which is set by WD=`dirname $0` returns '.', not the full path name, thus after the call to change directories to the lib directory by cd $WD/../lib, then calling $WD/shp2pgsql.bin does not give the correct location for the shp2pgsql.bin file because it is not located in ./ anymore since we already moved to /opt/PostgresPlus/8.4SS/lib.
I also found that the LD_LIBRARY_PATH variable was not different before the setting of LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH than it was after. Both times it was:
:/usr/lib/ogdi:/usr/local/terralib/terralibx/Release:/usr/lib/R/lib/libR.so
Firstly, why didn't the $PWD, which would have been /opt/PostgresPlus/8.4SS/lib at the time, get added to the front of it?
Secondly, do you think there could be any interference by the terralib libraries that are added there?
Now after all the above, I tried setting the PATH variable by typing the following in an xterm:
PATH=/opt/PostgresPlus/8.4SS/bin:$PATH
export PATH
echo $PATH now results in:
/opt/PostgresPlus/8.4SS/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Now it can find the shp2pgsql.bin file, however, no matter what file I use in the command line with the shp2pgsql I only ever get the print out of the help screen.
For example:
In my public/Unzip directory I have a shapefile called CSD.shp
A listing of the files shows:
~/public/Unzip$ ls CSD*
CSD.dbf CSD.prj CSD.sbn CSD.sbx CSD.shp CSD.shp.xml CSD.shx
A call as follows:
shp2pgsql -s 4269 ~/public/Unzip/CSD y2001.CSD
results in:
RCSID: $Id: shp2pgsql.c 4204 2009-06-24 11:18:29Z mcayland $ RELEASE: 1.4 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
USAGE: /opt/PostgresPlus/8.4SS/bin/shp2pgsql.bin [<options>] <shapefile> [<schema>.]<table>
OPTIONS:
...[snip]
There is no indication of error, just a print out of the help file, which obviously means there is an error, but how do I know what it is?!
I downloaded this shapefile to my Windows machine and used the following command:
shp2pgsql.exe -s 4269 C:\Junk\y2001\CSD y2001.CSD > C:\Junk\y2001\CSD.sql
It worked fine. The first part of the CSD.sql file looks like this:
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE "y2001"."csd" (gid serial PRIMARY KEY,
"area" numeric,
...[snip]
Does anyone have any idea why I cannot get this to work on the 64 bit Ubuntu Karmic machine? That is where all the data is and I don't want to be downloading and uploading from my windows machine.
Actually with an early install of the plain PostgreSQL 8.4 one click installer (postgresql-8.4.2-1-linux-x64.bin) on the Ubuntu machine when it was running Jaunty, I did manage to get shp2pgsql to work, so I am really at a loss to figure out what might be the problem now.
Thanks for your assistance.
Loretta
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 6 Mar 2010 02:14:22
|
Sachin_S
Senior member
Joined: 1 Aug 2008 02:37:24
Messages: 445
Offline
|
Hello,
A call as follows:
shp2pgsql -s 4269 ~/public/Unzip/CSD y2001.CSD
results in:
RCSID: $Id: shp2pgsql.c 4204 2009-06-24 11:18:29Z mcayland $ RELEASE: 1.4 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
USAGE: /opt/PostgresPlus/8.4SS/bin/shp2pgsql.bin [<options>] <shapefile> [<schema>.]<table>
OPTIONS:
USAGE indicates the command should be:
shp2pgsql [<options>] <shapefile> [<schema>.]<table>, where anything in [..] is optional.
You provided.
shp2pgsql -s 4269 ~/public/Unzip/CSD y2001.CSD
which meant :
<shapefile> = ~/public/Unzip/CSD
I believe thats what it is complaining about., change
<shapefile> = ~/public/Unzip/CSD.shp
See if the above works. I dont have a 64 bit machine off hand to test it out here.
|
--
Regards,
Sachin Srivastava
EnterpriseDB , the Enterprise Postgres company.
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 6 Mar 2010 17:35:20
|
Loretta_B-OB
New member
Joined: 28 Oct 2009 23:36:50
Messages: 9
Offline
|
Sorry, but I tried shp2pgsql -s 4269 home/loretta/public/Unzip/CSD y2001.CSD and I still get the same problem. All that gets printed out is the help file.
This time I was in the location of the CSD shape file when I called it, but I called it with its full path anyway.
Here is all I get:
$ shp2pgsql -s 4269 /home/loretta/public/Unzip/CSD y2001.CSD
RCSID: $Id: shp2pgsql.c 4204 2009-06-24 11:18:29Z mcayland $ RELEASE: 1.4 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
USAGE: /opt/PostgresPlus/8.4SS/bin/shp2pgsql.bin [<options>] <shapefile> [<schema>.]<table>
OPTIONS:
...
Thanks,
Loretta
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 6 Mar 2010 23:52:45
|
Loretta_B-OB
New member
Joined: 28 Oct 2009 23:36:50
Messages: 9
Offline
|
I see you wanted me to put the .shp on the end of the shapefile name. I didn't read carefully enough the first time. Anyway, I had already tried that before. I know that before when I had the plain PostgreSQL 8.4 version from the one click installer installed, I did not put the extension on the file and it worked fine.
Anyway, I am wondering about upgrading. If I put PostGIS version 1.5 on the machine with the current Postgres Plus installation, would I be able to use my already created databases with it, or would I have to go through the dump and restore process? Would there be any other issues?
Thanks,
Loretta
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 7 Mar 2010 02:59:02
|
Loretta_B-OB
New member
Joined: 28 Oct 2009 23:36:50
Messages: 9
Offline
|
Well, I ended up calling the .bin file as suggested by the printout as follows:
$ /opt/PostgresPlus/8.4SS/bin/shp2pgsql.bin -s 4269 /home/loretta/public/Unzip/CSD y2001.CA_CSD_CBF > /home/loretta/public/Unzip/CSD.sql
then using the results in a call to psql as follows:
$ /opt/PostgresPlus/8.4SS/bin/psql -f /home/loretta/public/Unzip/CSD.sql census censusOwner
and then for a second file, I used a pipe as follows:
shp2pgsql.bin -s 4269 ~/public/Unzip2/Canada y2001.Canada_CBF | psql census censusOwner
They both worked fine and I have two tables in my census database which look as I expected.
So the shp2pgsql wrapper must be screwing something up. Anybody got any ideas what the problem might be?
I put some echo print lines in the wrapper as follows:
(Note that I added the NEWWD=$PWD line, but all the rest was in the original file except the echo statements.)
(Also note that I am confident that the only change to the first call above to create the CSD.sql file that I made was to change the shp2pgsql.bin to shp2pgsql, since I used the up arrow in the xterm and just changed that part of the line.)
#!/bin/sh
CURRENTWD=$PWD
echo CURRENTWD: $CURRENTWD
echo PWD: $PWD
WD=`dirname $0`
echo WD: ${WD}
cd $WD/../lib
NEWWD=$PWD
echo NEWWD: ${NEWWD}
echo LD_LIB_PATH: ${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH $WD/shp2pgsql.bin
echo LD_LIB_PATH2: ${LD_LIBRARY_PATH}
cd $CURRENTWD
echo CURRENTWD: $CURRENTWD
And got the following when I ran it:
CURRENTWD: /home/loretta/public/backups
PWD: /home/loretta/public/backups
WD: /opt/PostgresPlus/8.4SS/bin
NEWWD: /opt/PostgresPlus/8.4SS/lib
LD_LIB_PATH: :/usr/lib/ogdi:/usr/local/terralib/terralibx/Release:/usr/lib/R/lib/libR.so
RCSID: $Id: shp2pgsql.c 4204 2009-06-24 11:18:29Z mcayland $ RELEASE: 1.4 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
USAGE: /opt/PostgresPlus/8.4SS/bin/shp2pgsql.bin [<options>] <shapefile> [<schema>.]<table>
OPTIONS:
...[snip]
-? Display this help screen
LD_LIB_PATH2: :/usr/lib/ogdi:/usr/local/terralib/terralibx/Release:/usr/lib/R/lib/libR.so
CURRENTWD: /home/loretta/public/backups
I am still wondering why that LD_LIBRARY_PATH wasn't updated, but it doesn't seem to matter anyway, since the shp2pgsql.bin file runs fine by itself without it!! It just can't seem to run properly when it is called by the wrapper.
Regards,
Loretta
|
|
|
 |
|
|