Skip to main content

Enabling PostGIS Shapefile and DBF Loader on pgAdmin III [Ubuntu]

When you install PostGIS from the OpenGeo Suite [link] on Ubuntu, you might notice that PostGIS Shapefile and DBF loader is missing from pgAdmin III plugins. This post explains the steps to get the plugin to work:

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.

Comments

Popular posts from this blog

Resolving INS-20802: Oracle Net Configuration Assistant failed error on Windows 10

I was all excited about the migration to Windows 10 until I had to install Oracle client 12.1.0.2 on it. The Oracle client installation used to fail miserably at the last stage with this error named INS-20802.

Turning off a Dell Laptop Monitor: Keyboard shortcut(s)

I am someone who is particular about power savings and I don't leave appliances powered on when not in use. The same applies to computing devices - be it a smartphone or a PC/Laptop. I power off the desktop monitor when I step out for a tea break or hit Fn+F2 on my Lenovo laptop that turns off the display. Recently, I got a Dell Laptop and I was surprised to discover that Dell does not provide any shortcut to turn off the display. This led to some exploration and I found two ways to achieve that which are outlined below - 

The Mutual Fund Mandate Conundrum

I always use the biller option in net banking to set up mutual fund SIPs. This time I was set to help an elderly gentleman to set up a SIP in a scheme run by UTI Mutual fund and that led me to write this post - one after several months in this blog! He has his savings account with a PSU - Canara Bank and I must say that is one tough bank to deal with. Every update requires a branch visit and they charge for literally everything - even for mobile number and email ID updates, separately. It cost us ₹59/- including GST. Tip : If you are unable to reset your net banking password for Canara Bank due to your date of birth not being registered with them, use the Unix default - 01 January 1970!