Dear All,

I am very new to postGIS. I have installed the postGIS and dcmms database on windows. I have loaded one shape file into the database. I have a script to be run on that database but i am not able to run it. Can some one please help me on how to do it. I have pasted that script here below.

if test $# -lt 4
then
        echo "Usage: $0 dbname plss_shapefile inpath outpath "
        echo 'Where dbname=name of the PostGIS database'
        echo 'plss_shapefile = name of the PLSS shapefile'
        echo 'inpath = the path where the shapefile resides'
        echo 'outpath = the path where your quad plss should reside'

else
        echo "drop table plss;"|psql -d $1
        echo "delete from geometry_columns where f_table_name='plss';"|psql -d
$1
        echo "drop table plss_quad;"|psql -d $1
        echo "delete from geometry_columns where f_table_name='plss_quad';"|psql -d $1         
        cd $3

        # Import the parcel shapefile into PostGIS database and in AEA projection
        ogr2ogr -f "PostgreSQL" PG:dbname=$1 $2 -nln plss -lco 'PRECISION=NO'
-lco 'OVERWRITE=YES' -nlt GEOMETRY
        # Build an index
        echo 'Create Index plss_index on plss using gist (wkb_geometry
GIST_GEOMETRY_OPS);'|psql -d $1

        # Vacuum Analyze
        echo 'vacuum analyze plss;'|psql -d $1

        # add column quadrant to the table
        echo 'alter table plss add column region varchar(40);'|psql -d $1
        echo "update plss set region='Northeast' where sec in
(1,2,3,10,11,12,13,14,15);"|psql -d $1
        echo "update plss set region='Northwest' where sec in
(4,5,6,7,8,9,16,17,18);"|psql -d $1
        echo "update plss set region='Southeast' where sec in
(22,23,24,25,26,27,34,35,36);"|psql -d $1
        echo "update plss set region='Southwest' where sec in
(19,20,21,28,29,30,31,32,33);"|psql -d $1

        echo "alter table plss add column quadrant varchar(50);"|psql -d $1

        echo "update plss set quadrant='TWP. '||twn||TD||' - RNG. '||rng||RD||'
('||region||')';"|psql -d $1
        
        # Do a dissolve based on quadrant
        echo 'create table plss_quad as select quadrant as Quadrant,
geomunion(wkb_geometry) as wkb_geometry from plss group by quadrant;'|psql -d $1
        #or
        #echo 'create table plss_quad as select geomunion(wkb_geometry), covertype from
plss group by quadrant;'|psql -d $1
        # echo 'select buffer(collect(wkb_geometry), 0) from plss'|psql -d $1;
        
        #get the srid of plss
        temp=`echo "select srid from geometry_columns where f_table_name='plss';"|psql
-d $1`
        srid=`echo $temp|awk '{print $3}'`
        echo "insert into geometry_columns
values('','public','plss_quad','wkb_geometry',2,$srid,'GEOMETRY');"|psql -d $1
        ogr2ogr -f "ESRI Shapefile" $4/plss_quad.shp PG:dbname=$1 plss_quad

<br><hr align="left" width="300">
View this message in context: <a href="http://www.nabble.com/Running-post-GIS-script-tf2889609.html#a8072761">Running post GIS script</a><br>
Sent from the <a href="http://www.nabble.com/PostGIS---User-f1223.html">PostGIS - User</a> mailing list archive at Nabble.com.<br>