Difference between revisions of "Database connection to QGIS using OpenGeo Explorer"

From CUOSGwiki
Jump to navigationJump to search
Line 6: Line 6:
 
==What is QGIS==
 
==What is QGIS==
   
[[File:QGIS_logo.png.extension]]
+
[[File:|200px|thumb|left|alt text]]
   
 
[https://www.qgis.org/en/site/about/index.html QGIS] is an Open Source Geographic Information System that is licensed under the GNU General Public License, and is user friendly. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). This program runs on Linux, Unix, Windows, Android and Mac OSX. It is able to support numerous [https://en.wikipedia.org/wiki/Raster raster], [https://docs.qgis.org/2.8/en/docs/gentle_gis_introduction/vector_data.html vector] data and database formats.
 
[https://www.qgis.org/en/site/about/index.html QGIS] is an Open Source Geographic Information System that is licensed under the GNU General Public License, and is user friendly. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). This program runs on Linux, Unix, Windows, Android and Mac OSX. It is able to support numerous [https://en.wikipedia.org/wiki/Raster raster], [https://docs.qgis.org/2.8/en/docs/gentle_gis_introduction/vector_data.html vector] data and database formats.

Revision as of 16:21, 29 September 2019

GIS

Geomatics involves analyzing spatial patterns and processes while using tools that are state-of-the-art. These tools include Geographic Information Systems (GIS). GIS can be used for geographic problem solving in environmental science and conservation, transportation, health, risk analysis, resource assessment and urban planning.

What is QGIS

[[File:|200px|thumb|left|alt text]]

QGIS is an Open Source Geographic Information System that is licensed under the GNU General Public License, and is user friendly. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). This program runs on Linux, Unix, Windows, Android and Mac OSX. It is able to support numerous raster, vector data and database formats.

Database and Connection

Geospatial Data Storage

The main aspect of GIS processing tools is their application to various datasets. Generally, input data undergoes operations that produce output. Depending on the purpose of the analysis the resulting data may be archived, packaged as a base dataset with other geospatial data, or made available for a more dynamic transfer to the next set of tools. The last example may include cases of greater calls frequency, where some online sharing methods offer more advantage. These methods assume that data becomes available in the same instant as being changed or upgraded. Databases are widely used and now offer geospatial compatibility.

Software Stack

Information exchange through database can be done through networks ranging from one local machine to worldwide web. In order to acheive complete functionality of the FOSS4G tool, use of specific versions of GIS desktop and server is necessary. Two sides have to have following software installed: client-side requires QGIS 2.0 Dufour or later, and server-side should run latest version of either GeoServer or PostGIS, where PostGIS is an extension of PostgreSQL database server. Configuration settings should be consulted with the developers' manuals.

OpenGeo Explorer

Boundless is a provider of the open source and enterprise geospatial software solutions. In 2013 it has contributed to QGIS project by releasing OpenGeo Explorer plugin. This tool is designed to work with OpenGeo Suite, commercial open source based platform, and simplify online publishing of geospatial data. While it can be used without the OpenGeo Suite, it allows data transfer between QGIS and GeoSever or PostGIS.

Installation

OpenGeo Explorer can be downloaded and installed through QGIS Plugin Manager.

  1. In the main menu go to Plugins > Manage and Install Plugins...
  2. In the Plugin Manager window go to Settings, check Show also experimental plugins, and press Add... to specify new repository
  3. Enter name and URL of repository, where URL is http://qgis.boundlessgeo.com/plugins.xml (there also is a repository at GitHub), press OK

    Fig1 01.jpg
    Add new repository dialog window

  4. Navigate to Get more in same Plugin Manager window and highlight OpenGeo Explorer from the list - press Install plugin
  5. Make sure that OpenGeo Explorer is checked under Installed tab and close Plugin Manager
  6. New section in the main menu called OpenGeo should appear, which provides tool's switch, settings, and help

Setup

The plugin contains graphical interface in the form of scalable window, that can be snapped to the margins of the QGIS window. It is divided into two areas: connections tree (or tab view if tool's settings are configured), and Actions list.

Fig1 02.jpg

Tree view: GeoServer catalogs, PostGIS connections, and current QGIS project layers

Fig1 03.jpg

Tab view: GeoServer catalogs, PostGIS connections, and current QGIS project layers

GeoServer can be connected by highlighting GeoServer catalogs in the connections tree and pressing either the plus sign ("+") button or New catalog... link in the actions menu on the bottom. Catalog definition dialog opens up. Make sure to provide information exactly how it appears in the server records, such as not including forward slash at the end of the catalog's URL. If a catalog had been successfully connected, then tree will expand and include Workspaces, Layers, Groups, Styles, WPS processes, and Settings

Fig2 01.jpg New GeoServer connection dialog window


PostGIS connections are added in the same manner as above. The Create new PostGIS connection dialog is structured in slightly different way. Once added, newly established connection provides access to the schemas available in the database.

Fig2 02.jpg

New PostGIS connection dialog window


Data transfer

The presence of the OpenGeo Explorer within QGIS panel simplifies the access to the database. The layers can be processed, uploaded to the database, then downloaded back again. Deleting and importing of files in the database are enabled through the tool. Fig2 03.jpg Working view of OpenGeo Explorer
For QGIS to Database transfer take following steps, assuming that at least one layer is present in QGIS project:

  1. Highlight the required layer under QGIS project in OpenGeo Explorer
  2. Choose and click either Publish to GeoServer... or Import into PostGIS... in Actions list
  3. Fill out required information in the prompted dialog window

Fig3 02.jpg Import dataset to GeoServer dialog window

Fig3 01.jpg Import dataset to PostGIS dialog window

In order to download from Database to QGIS, layers only need to be dragged while holding left mouse button from the OpenGeo Explorer window to the Layers tab in QGIS panel.

Grid Layer Storage

Conclusion

References

Geomatics