Hi Mark, shp2pgsql just generates SQL statements to create the shapefile data. psql actually executes those statements, so that's where you want to specify connection parameters for the other server.
http://www.postgresql.org/docs/9.2/static/app-psql.html So something like: for %%f in (*.shp) do shp2pgsql -d -I -s 103749 -W LATIN1 %%f %%~nf | psql -w -h 192.168.1.50 -U postgres -d lyongis You can put your authentication credentials into a .pgpass file to avoid retyping the password for each shapefile. http://www.postgresql.org/docs/9.3/static/libpq-pgpass.html Also note that your remote server will need to be configured to allow external connections and password authentication for the postgres user. Best, Shane On Wed, May 14, 2014 at 8:50 AM, Mark Volz <[email protected]> wrote: > Hello, > > I understand that I can use shp2pgsql to load shapefiles on the localhost. > I would like to know load data onto another server, and I would like to > verify that I am doing everything correct. Specifically: > > 1) How I can adjust this code so that I can update the gis data on a > different server? > 2) How will I specify the password on a different machine? > 3) Do I need to do anything in addition to this to create spatial indexes? > > Current code that I am using to load a directory of shapefiles. > > set PATH=C:\Program Files\PostgreSQL\9.2\bin;%PATH% > for %%f in (*.shp) do shp2pgsql -d -I -s 103749 -W LATIN1 %%f %%~nf | psql > -w -U postgres -d lyongis > > > Thanks > > Sincerely, > Mark Volz, GISP > Lyon County GIS Coordinator > > > _______________________________________________ > postgis-users mailing list > [email protected] > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users > -- Shane StClair Software Engineer Axiom Consulting & Design http://www.axiomalaska.com
_______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
