20

I have installed PostgreSQL 9.1 with PostGIS 1.5.3 on Ubuntu 11.10.

I also installed pgadmin3 1.14.0-beta1, following this instructions.

If I remember correctly, when I installed PostGIS on Windows pgadmin automagically came with Shapefile GUI Loader plugin already installed. On Ubuntu however, the plugin drop down menu is empty.

Instructions I found seems to be Windows specific.

Is there a way to install / enable it on Ubuntu?

4
  • 1
    there's a --with-gui configure flag if you install PostGIS from source, but I've never tried this so I can't say if it works
    – Mike T
    Commented Oct 25, 2011 at 19:53
  • @MikeToews: Thanks. I noticed it in the docs as well now. Well worth remembering for the future but I'm still hoping to enable it in already installed stack.
    – user173
    Commented Oct 26, 2011 at 21:51
  • 1
    I have the same problem. I was able to install the opengeo-postgis-shapeloader thru synaptic package but I can't see it in pgAdmin3. I'm using Xubuntu 10.04
    – user5626
    Commented Jan 25, 2012 at 5:59
  • I couldn't get the --with-gui flag to work on ubuntu. You could download the OpenGeo package opengeo.org/technology/suite/download and use the gui that comes with it, but it's not ideal.
    – djq
    Commented Feb 11, 2012 at 1:24

9 Answers 9

12

If you want a painless install, you might want to start over and use the OpenGeo Suite version of PostGIS.

$sudo wget -qO- http://apt.opengeo.org/gpg.key | apt-key add -
$sudo echo "deb http://apt.opengeo.org/ubuntu lucid main" >> /etc/apt/sources.list
$sudo apt-get update
$apt-cache search opengeo
$sudo apt-get install opengeo-postgis

Or you could just install the shape loader instead of the whole postgis package.

$sudo apt-get install opengeo-postgis-shapeloader  

It would be installed in /usr/sbin you need to make a symbolic link to $$PGBINDIR ( which in this case is in /usr/bin )

$sudo ln -s /usr/sbin/shp2pgsql-gui /usr/bin/shp2pgsql-gui

Finally, in your plugins.ini file:

;
; pgShapeLoader (Linux):
;
Title=PostGIS Shapefile and DBF loader
Command=$$PGBINDIR/shp2pgsql-gui -U $$USERNAME -d $$DATABASE -p $$PORT -h $$HOSTNAME
Description=Open a PostGIS ESRI Shapefile or Plain dbf loader console to the current database.
KeyFile=$$PGBINDIR/shp2pgsql-gui
Platform=unix
ServerType=postgresql
Database=Yes
SetPassword=No

As you're using pgadmin3 1.14.0, I think you need to place the plugins.ini under /usr/share/pgadmin3/plugins.d/. Lower versions put it under /usr/share/pgadmin3/

15
  • Thanks for that. Tried your second method and updated my plugins.ini file - unfortunately it didn't change anything :/
    – user173
    Commented Feb 9, 2012 at 0:45
  • Hmmm... I took that plugins.ini file from the OpenGeo version. Maybe you have to set the parameters to match your current configuration? I just checked the package listings at pkgs.org. Could you verify if shp2pgsql is in your PGBINDIR?
    – R.K.
    Commented Feb 9, 2012 at 3:01
  • How exactly could i verify that?
    – user173
    Commented Feb 9, 2012 at 9:54
  • Could you run find and check if shp2pgsql-gui exists in your filesystem?
    – R.K.
    Commented Feb 10, 2012 at 23:51
  • 1
    Shouldn't it be wget -qO- apt.opengeo.org/gpg.key | sudo apt-key add -
    – hoge6b01
    Commented Feb 3, 2013 at 9:28
5

I can't believe I'm having the same issue in 2014 with 12.04.

Neither the GUI nor command-line shapeloader install using the opengeo-suite.

I simply followed the noob-friendly directions on this website: http://www.staygeo.com/2013/05/enabling-postgis-shapefile-and-dbf.html, which parallel the instructions by RK almost 2 years ago.

"Install opengeo-postgis2-shapeloader using this command at terminal:

sudo apt-get install opengeo-postgis2-shapeloader

It gets installed in /usr/lib/postgresql/9.2/bin as shp2pgsql-gui. Now create a symbolic link for the same in /usr/bin directory. Prior to this you may want to check if the postgresql version you have is 9.2.

sudo ln -s /usr/lib/postgresql/9.2/bin/shp2pgsql-gui /usr/bin/shp2pgsql-gui 

Now it's the time to edit plugins.d file. Use the following command to open the file for editing:

gksudo gedit /usr/share/pgadmin3/plugins.d/plugins.ini

Paste the following contents at the end of the file:

;
; pgShapeLoader (Linux):
;
Title=PostGIS Shapefile and DBF loader
Command=$$PGBINDIR/shp2pgsql-gui -U $$USERNAME -d $$DATABASE -p $$PORT -h $$HOSTNAME
Description=Open a PostGIS ESRI Shapefile or Plain dbf loader console to the current database.
KeyFile=$$PGBINDIR/shp2pgsql-gui
Platform=unix
ServerType=postgresql
Database=Yes
SetPassword=No

Note: You may have to set the environment variable PGBINDIR on your machine. To check if the environment variable is already set type this on your terminal:

echo $PGBINDIR

If an empty line appears as a result, it indicates that environment variable is not set. You will have to set it to /usr/bin (the location where the symbolic link for shapefile loader resides). For that use this command:

PGBINDIR=/usr/bin

Once the above steps are done invoke pgAdmin III to see the 'PostGIS Shapefile and DBF Loader' listed under plugins."

No copyright intended (it's well-written so I didn't paraphrase :).

1
  • 1
    With my installation of PostGIS/QGIS from the ubuntugis-stable ppa the shp2pgsql-gui comes already installed, all I had to do was add the code to the plugins.ini file.
    – raphael
    Commented Dec 22, 2014 at 3:47
3

This response may be late,but i had the same trouble and i found the solution. Try this command on your terminal :

$sudo ln -s /usr/lib/postgresql/9.1/bin/shp2pgsql /usr/bin/shp2pgsql
0
1

You could try the instructions here. It's definitely a separate executable on Fedora. Also, have you tried:

sudo apt-get install shp2pgsql-gui?

1
  • 1
    I thought about sudo as well. Unfortunately response is: Unable to locate package shp2pgsql-gui. Thanks for other pointer - will have a look.
    – user173
    Commented Oct 26, 2011 at 21:50
1

Step1. Create folder name: plugin.d in folder PgAminIII Ex:

C:\Program Files\OpenGeo\OpenGeo Suite\pgsql\9.1\pgAdmin III\plugins.d

Step2. Create files config for app you need in new plugins folder

EX: postgis.shp2pgsql-gui

 psql

detai file: postgis.shp2pgsql-gui:

; ; PostGIS shp2pgsql-gui (Windows): ;

Title=PostGIS Shapefile and DBF loader 2.0
Command="$$PGBINDIR\shp2pgsql-gui.exe" -h "$$HOSTNAME" -p $$PORT -U "$$USERNAME" -d "$$DATABASE" -W "$$PASSWORD"
Description=Open a PostGIS ESRI Shapefile or Plain dbf loader console to the current database.
KeyFile=$$PGBINDIR\shp2pgsql-gui.exe
Platform=windows
ServerType=postgresql
Database=Yes
SetPassword=Yes
1
  • Thanks, but the question was meant to be Ubuntu/Linux specific..
    – user173
    Commented Sep 27, 2013 at 8:27
0

It seems this is found in the Ubuntu PostGIS repository, and the bottom of the PostGIS Debian Instructions covers how to install it:

Open terminal, and type:

sudo apt-get install postgis

(Note: this is coming from the main Ubuntu software repository, as it seems the PostgreSQL APT repository doesn't package SHP2PGSQL-GUI anymore...)

Now open the SHP2PGSQL application:

shp2pgsql-gui

Follow the on-screen prompts to load your data.

0

The application name is shp2pgsql-gui, its located inside the postgis-gui package. Install it and search for it your linux programs. It start it outside of pgadmin3. This is the trick i use always.

sudo apt-get install postgis-gui

0

Okay 2020
Ubuntu 18.04
Postgresql 10
postgis 2.5
pgadmin3 (written in php?) pgamdin4 seems to be python so havent figured out how to apply it to that yet.

to install the shapeloader
sudo apt install postgis-gui

sudo vim /usr/share/pgadmin3/plugins.d/plugins.ini
then add this to the end of plugins.ini

;
; pgShapeLoader (Linux):
;
Title=PostGIS Shapefile and DBF loader
Command=/usr/bin/shp2pgsql-gui -U $$USERNAME -d $$DATABASE -p $$PORT -h $$HOSTNAME
Description=Open a PostGIS ESRI Shapefile or Plain dbf loader console to the current database.
KeyFile=/usr/bin/shp2pgsql-gui
Platform=unix
ServerType=postgresql
Database=Yes
SetPassword=No

Thanks to @Shmuck Jones for his answer

-1

I think the package postgis from the ubuntu repo will install everything you need, as explained in the last lines of https://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21UbuntuPGSQL93Apt

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.