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?

radek
  • 10,579
  • 12
  • 86
  • 121
  • 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 Oct 25 '11 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. – radek Oct 26 '11 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 –  Jan 25 '12 at 05:59
  • I couldn't get the --with-gui flag to work on ubuntu. You could download the OpenGeo package http://opengeo.org/technology/suite/download/ and use the gui that comes with it, but it's not ideal. – djq Feb 11 '12 at 01:24

9 Answers9

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/

R.K.
  • 17,405
  • 3
  • 59
  • 110
  • Thanks for that. Tried your second method and updated my plugins.ini file - unfortunately it didn't change anything :/ – radek Feb 09 '12 at 00: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. Feb 09 '12 at 03:01
  • How exactly could i verify that? – radek Feb 09 '12 at 09:54
  • Could you run find and check if shp2pgsql-gui exists in your filesystem? – R.K. Feb 10 '12 at 23:51
  • Changed my answer. Please check if it works this time. I'll test it on my box, too as soon as I get home. – R.K. Feb 11 '12 at 01:25
  • Thanks for more hints. My shp2pgsql-gui exists in /usr/bin. It does work without any problems when I simply double click it. I already had symbolic link that you mention created. Also tried moving plugins.ini to plugins.d directory (which did't exist on my machine. Restarted Postgres and still no link to the loader in pgadmin :/ – radek Feb 11 '12 at 12:44
  • Also tried moving plugins.ini to plugins.d directory (which did't exist on my machine > Did you create the missing directories? Did some reading and found out that pgadmin3 1.14.0 expects the .ini files to be in /usr/share/pgadmin3/plugins.d/ You might want to create those directories. – R.K. Feb 11 '12 at 13:58
  • plugins.d directory didn't exist on my machine. Had to create it and then moved ini file there. – radek Feb 11 '12 at 17:43
  • Oh... my bad. This is one tough problem. x_x – R.K. Feb 11 '12 at 22:47
  • I'm officially out of ideas. Changing the platform in the plugins.ini from platform=linux to platform=unix fixed it for me. – R.K. Feb 11 '12 at 23:30
  • Thanks for effort. Will try opengeo version for my next install. – radek Feb 12 '12 at 00:17
  • 1
    Shouldn't it be wget -qO- http://apt.opengeo.org/gpg.key | sudo apt-key add - – hoge6b01 Feb 03 '13 at 09:28
  • On my system (ubuntu 12.10), I only had to insert the plugins.ini definition. I think the plugin itself was installed with postgis from the ubuntugis-unstable ppa (see http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1210). There is therefore no need to install the opengeo version of postgis on more recent versions of Ubuntu, but do use the plugins.ini definition given above. – rudivonstaden Mar 20 '13 at 10:06
  • I faced the same issue with the plugin on Ubuntu 12.04. Followed similar steps outline above except for different file paths. I had to set PGBINDIR environment variable as well. I have explained the steps I followed in my blog post: http://www.staygeo.com/2013/05/enabling-postgis-shapefile-and-dbf.html – Chethan S. May 19 '13 at 06:53
  • FYI the first link doesn't point to where it used to. – raphael Sep 15 '16 at 17:30
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 :).

Shmuck Jones
  • 51
  • 1
  • 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 Dec 22 '14 at 03: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
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?

Stev_k
  • 6,689
  • 2
  • 34
  • 46
  • 1
    I thought about sudo as well. Unfortunately response is: Unable to locate package shp2pgsql-gui. Thanks for other pointer - will have a look. – radek Oct 26 '11 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
urcm
  • 22,533
  • 4
  • 57
  • 109
Hang
  • 11
  • 1
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

saviour123
  • 379
  • 3
  • 13
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

Craicerjack
  • 143
  • 6
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.

DPSSpatial_BoycottingGISSE
  • 18,790
  • 4
  • 66
  • 110
-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

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
ismael
  • 1
  • 1