Today I would like to go over how to install and use this tool with the hope that it will become a great help to all those wanting to leverage the power of OSGIS in their organization.
First method: Installing this package really couldn't be any easier. After downloading the archive file unzip it to the user specific Python Plugin directory (C:\Users\
Second method: You can also install PgQuery by opening QGIS and selecting the Fetch Plugins item under the Plugins menu. In the resulting dialog select the PgQuery for QGIS entry and select the Install/upgrade plugin button.
After doing either one of these methods you can activate the plugin using the QGIS Plugin Manager (PM). It will then show in PM as PgQuery for QGIS (Version 0.1.1. You can just select this plugin and you will see a new entry for PgQuery under plugins as well as an icon on the tool bar.
To run the app either select PgQuery for QGIS from the plugins menu or the icon from the tool bar. When the application opens you will see a number of controls on the main form:
- An Output Schema pull down to allow you to select the schema of any output tables
- An Output Table box which is self explanitory
- A Query box which allows you to create queries from scratch, add query components from some of the other controls, or select a query template from the Query Template pull down.
- A Query Template pull down as described in 3. When you select a query template it builds the query for you from the pre loaded queries or from a query that you have built and saved to the default location.
- A Functions list box which allows you to double click to add functions to the query at your current cursor location.
- A Tables tree control that shows a list of all the tables available in the currently loaded PostgreSQL database. If the table is spatial the geometry type will show in the column beside the Table column. You can also double click the tables to add them to the query.
- Finaly the Geometry Column pull down that allows you to select the geometry column from any of the currently selected tables.
You will also find a number of menu items at the top.
- Under the File menu there are sub menus to allow you to:
- Open an existing project file that will bring you back to a previous state of SQL query development
- A Save and Save As menus to save the appropriate project files
- And, of course, and exit menu to close the application entirely.
- The Run menu which runs the current query as shown in the query box on the currently active database
- The Save menu to allow the current query to be saved to a Query Template file for later use.
- The Clear menu that allows all query statements to be cleared to start over from scratch.
- And a Check Box that allows the user to select whether or not they want to add the resulting spatial table to be added as a geometry data set to the QGIS map view.
- Basic Help with PgQuery for QGIS
- And a basic About PgQuery statement
You will also need to have PyQt and Python for QGIS installed. All of these can be installed using the online stack builder that comes with the OSGeo4W installation. Make sure to read the INSTALL.txt file that comes bundled with the plug-in.
You will also find a help document in the "docs" folder of the pgquery_plugin directory. this help doc is called help.html which can be opened in any browser and gives you some guidance for using this tool.
Try it out and see how powerful PostGIS can be in your enterprise GIS environment. This enterprise database application has hundreds of spatial functions that allow you to perform myriad geoprocessing and analytical tasks. For more assiatance on PostGIS you can go to http://postgis.refractions.net/ and look at the documentation available there.
I hope you find this tool very useful and that it brings enterprise GIS into the reach of ANY organization regardless of size of budget.