Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
add comment

5 Answers

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

share|improve this answer
add comment

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
add comment

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
add comment

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=192.168.123.12 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
add comment

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
add comment

Your Answer

 
discard

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.