Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can we import a Shapefile from a system which doesn't have PostgreSQL installed (client machine) into a system having PostGIS installed?

I am getting problem with 'shp2pgsql' and 'psql' since both are not recognized on the client machine.

I am trying this using console.

share|improve this question

Not a command line solution, but since you tagged the question QGIS:

I recommend using QGIS PostGIS Manager plugin which is a GUI for shp2pgsql which allows you to upload Shapefiles to a remote database.

enter image description here

share|improve this answer

I think that if you qgis installed you will have also ogr2ogr (It's provided with the gdal-bin package). With the following command you will create a table called yousahpefile in your database:

ogr2ogr -f PostgreSQL PG:"host=server_ip user=username dbname=dbname password=password" yourshapefile.shp;

There are some workarounds if you find troubles with the encoding.

share|improve this answer
except replace localhost with the IP address of the remote PostGIS database, e.g. host= or whatever – Mike T Oct 16 '11 at 10:21
Thanks Mike you are right i edit my post – Francisco Puga Oct 16 '11 at 16:33

You'll need to install shp2psql on the client machine or copy the shapefile to a machine with it installed.

share|improve this answer

I think you just need to copy the relevant files. I've done this on ewindows. Haven't tried on Linux. For windows I copy the shp2pgsql.exe, libpq.dll, libiconv-2.dll, comerr32.dll, msvcr71.dll , a couple of others but those are the key ones -- these are located in the PostgreSQL bin folder

Linux ones would be different but libpq and shp2pgsql are definitely required

share|improve this answer

You can either use shp2pgsql on your local copy of the database, create a dump of the new database and upload it, ... or install shp2pgsql on the remote machine, scp the shapefile over, and shp2pgsql from there (as iant recommends).

AFAIK there is no way to do this remotely in one step. This is because even if you have access to the remote database from where you are, the functions you are using (such as shp2pgsql) are the ones installed on the server, regardless of what is on your local machine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.