<div dir="ltr">Hi Mark,<div><br></div><div>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.</div>
<div><br></div><div><a href="http://www.postgresql.org/docs/9.2/static/app-psql.html">http://www.postgresql.org/docs/9.2/static/app-psql.html</a><br></div><div><br></div><div>So something like:</div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">    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</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">You can put your authentication credentials into a .pgpass file to avoid retyping the password for each shapefile.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><font face="arial, sans-serif"><a href="http://www.postgresql.org/docs/9.3/static/libpq-pgpass.html">http://www.postgresql.org/docs/9.3/static/libpq-pgpass.html</a></font><br>
</div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Also note that your remote server will need to be configured to allow external connections and password authentication for the postgres user.</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Best,</font></div><div><font face="arial, sans-serif">Shane</font></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 14, 2014 at 8:50 AM, Mark Volz <span dir="ltr"><<a href="mailto:MarkVolz@co.lyon.mn.us" target="_blank">MarkVolz@co.lyon.mn.us</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
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:<br>
<br>
1)  How I can adjust this code so that I can update the gis data on a different server?<br>
2)  How will I specify the password on a different machine?<br>
3)  Do I need to do anything in addition to this to create spatial indexes?<br>
<br>
Current code that I am using to load a directory of shapefiles.<br>
<br>
set PATH=C:\Program Files\PostgreSQL\9.2\bin;%PATH%<br>
for %%f in (*.shp) do shp2pgsql -d -I -s 103749 -W LATIN1 %%f %%~nf | psql -w -U postgres -d lyongis<br>
<br>
<br>
Thanks<br>
<br>
Sincerely,<br>
Mark Volz, GISP<br>
Lyon County GIS Coordinator<br>
<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Shane StClair<br>Software Engineer<br>Axiom Consulting & Design<br><a href="http://www.axiomalaska.com" target="_blank">http://www.axiomalaska.com</a>
</div>