PostGIS Search QGIS Plugin

QGIS Plugin for searching PostGIS database

View the Project on GitHub tjmgis/PostGISSearch

PostGIS Search QGIS Plugin

This project page is a guide for the using the PostGIS Search QGIS Plugin. This information should enable any user to get the plugin installed and being used without issues.

Background

I tend to use QGIS for all of my desktop GIS needs and when I do I also tend to use a Web Map Service (WMS) as my backdrop map. As a result I find myself panning and zooming the map to find a location or a road that I need to look at. This is painful and sometime I do not know where a location is.

So the intention for the PostGIS Search plugin is to bring the autocomplete search we are used to using on web applications into the Desktop GIS, by allowing the user to search a database and automatically move the map to that location.

Installation

The plugin has now been accepted into the plugin repository and can therefore be download via QGIS>Plugins>Manage and Install Plugins and then find PostGIS Search on the list.

The paths for the plugin directory are:

Home directory (denoted by above ~) on Windows is usually something like C:\Documents and Settings(user).

When you next open QGIS the plugin should be available but before that there is some configuration that is required before the plugin can be used.

Configuration

Within the PostGIS_Search folder there is a postgis.ini file. This file contains the configuration that the plugin uses to know what database and column to query.

Open the postgis.ini in a text editor and the file should look like this:

[postgis]
postgisdatabase =                ;database name as exists in postgresql/postgis
postgisusername =                ;database user, commonly postgres
postgispassword =                ;password to match the user declared above
postgishost =                    ;host computer where postgresql is, often localhost
postgisport =                    ;port number, often 5432
postgisschema =                  ;schema name of the table
postgistable =                   ;table for the plugin to search
postgissearchcolumn =            ;specific column for the plugin to search
postgisdisplaycolumn =           ;comma seperated list of columns to display
postgisgeomname =                ;geometry column to get coordinates to move map to
searchmethod =                   ;search type, either SQL or FTS are valid options here

You will need to add in the relevant details. The comments on the right hand side should help you fill in the details but here is a template that I use to query Code-Point Open.

[postgis]
postgisdatabase = data               
postgisusername = postgres               
postgispassword = postgres               
postgishost = localhost                    
postgisport = 5432                    
postgisschema = public                  
postgistable =  codepoint                 
postgissearchcolumn = postcode            
postgisdisplaycolumn = postcode           
postgisgeomname = geom               
searchmethod = SQL                   

Once you have altered the configuration file (postgis.ini) save your edits and close the text editor.

You should now be able to launch QGIS and enable the plugin from the Plugins>Manage and Install Plugins> then from that list select PostGIS Search.

If you want to change the database or column the plugin is searching simply open the postgis.ini configuration file and make the changes and save and exit. You DO NOT have to close down QGIS and reopen to pick up this changes. The configuration is parsed when the plugin is activated.

Errors

The plugin has been written to present the user with useful message boxes. So if the plugin does not work there should be enough of an error message to explain the problem.

If not I would double check the postgis.ini configuration file and that it has the correct details to connect to the PostGIS database you would like to query.