Running post GIS script

View: New views
8 Messages — Rating Filter:   Alert me  

Running post GIS script

by kmohan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Running post GIS script

by Steffen Macke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

>  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

The script looks like a UNIX shell script. Which shell are you using
to run the script?

Regards,

Steffen
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Running post GIS script

by kmohan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I am using the Windows XP only. I have installed the postGIS with DCMMS database in the windows workstation.

Thanks and Regards,

Krishna Mohan

Steffen Macke wrote:
Hi,

>  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

The script looks like a UNIX shell script. Which shell are you using
to run the script?

Regards,

Steffen
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Running post GIS script

by Steffen Macke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Krishna,

> I am using the Windows XP only. I have installed the postGIS with DCMMS
> database in the windows workstation.

In this case you'll be missing the UNIX shell. Which PostGIS/PostgreSQL version
do you use? Where did you find the script, why do you think it should
work for you?

Regards,

Steffen
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Running post GIS script

by kmohan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am using postGREsql 8.0. I have got the script from a client which merges certain polygons and combines the attributes. I need to run this program to perform that operation. Do you think I require Unix shell for windows in this case.

Thanks and Regards,

Krishna Mohan
Steffen Macke wrote:
Hi Krishna,

> I am using the Windows XP only. I have installed the postGIS with DCMMS
> database in the windows workstation.

In this case you'll be missing the UNIX shell. Which PostGIS/PostgreSQL version
do you use? Where did you find the script, why do you think it should
work for you?

Regards,

Steffen
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Running post GIS script

by Steffen Macke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> perform that operation. Do you think I require Unix shell for windows in
> this case.

Yes, unless you want to convert your shell script into a batch file.
You can try MinGW/MSYS - they provide a UNIX-type shell for Windows:

http://www.mingw.org

Regards,

Steffen
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Running post GIS script

by kmohan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Many thanks for the same. Can you please also let me know how to convert the shell script to batch file.

Many thanks,

Krishna Mohan
Steffen Macke wrote:
> perform that operation. Do you think I require Unix shell for windows in
> this case.

Yes, unless you want to convert your shell script into a batch file.
You can try MinGW/MSYS - they provide a UNIX-type shell for Windows:

http://www.mingw.org

Regards,

Steffen
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Running post GIS script

by Markus Schaber-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, kmohan,

kmohan <krishnamohan@...> wrote:

> Many thanks for the same. Can you please also let me know how to convert the
> shell script to batch file.

The only way I know of is manually.

That means, read and understand the shell script, and write a batch
file that does the same.

Alternatively, you can interpret the shell script "in your mind",
and execute the SQL commands in psql, probably using copy/paste.

Regards,
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users