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.

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.


Troubleshooting a Constantly Freezing Windows 10 PC

On my Windows 10 Home, I was being bugged by constant freezes which forced me to hard reboot now and then. Since I use Ubuntu as my primary OS, I chose to adjust with this for long. However, this became more of a trouble in the recent times with Windows starting up at 98% CPU usage and every process actually showing 0% CPU usage. That's when I decided to get into the root of the problem and resolve it. I was confident that the hardware was fine since Ubuntu worked perfectly all the time.
It turned out that many Windows 10 users, especially those who upgraded from previous versions of Windows 7 or 8 / 8.1 faced similar freezing issues. The answers at Windows Forums by Microsoft staffers generally suggested using the command sfc /scannow to verify that system files were intact. However, most users found it unhelpful and that didn't help me either.

SSL VPN: Configuring and Using Forticlient on Ubuntu, creating a Launcher

Is your primary OS at home Linux and do you use Windows only to connect to your work PC over VPN or to attend meetings? Do you often wish to connect to your work VPN from a Linux PC?  If your answer is 'Yes' to the above questions, I have an answer if your workplace uses Fortinet SSL VPN. Note that it's possible to connect to Fortinet and other VPNs like Cisco VPN from Linux through the inbuilt network manager by installing additional tools but this post would focus on using the standard Forticlient for accessing the resources on your work network.
Obtaining Forticlient The most important thing to note w.r.t. using Forticlient for Ubuntu (or any Linux distro) is to note that the client is not publicly available for download from the official website. You will have to ask your IT department to download the client for you, in case they haven't provided it.