[postgis-users] Uploading data to a different server via command prompt

Rémi Cura remi.cura at gmail.com
Thu May 15 00:21:43 PDT 2014


Hey,
to test stuff, shp2pgsql-gui may be faster.

Cheers,
Rémi-C


2014-05-14 18:20 GMT+02:00 Shane StClair <shane at axiomalaska.com>:

> 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 <MarkVolz at co.lyon.mn.us> 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
>> postgis-users at lists.osgeo.org
>> 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
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140515/4dc0437b/attachment.html>


More information about the postgis-users mailing list