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

From CUOSGwiki
Jump to navigationJump to search
 
(36 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<table border=0 width=750><tr><td>
 
<table border=0 width=750><tr><td>
  +
=Background=
   
==GIS==
+
==What is QGIS?==
[https://carleton.ca/geography/geomatics/ 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.
 
   
  +
[https://www.qgis.org/en/site/about/index.html QGIS] is a free, and Open Source Geographic Information System. An alternative to the standard, but expensive [https://www.arcgis.com/index.html ArcGIS]. QGIS is an official project of OSGeo (Open Sourse Geospatial Foundation). The system is regularly updated, and is supported on Linux, Windows, and MacOS. It boasts an extensive community who regularly improve the system, as well as adding new features. This tutorial will focus on a Windows specific setup.
==What is QGIS==
 
   
  +
==OpenGeo Explorer==
[[File:QGIS logo.png]]
 
   
  +
OpenGeo Explorer is a plugin which was originally developed by Boundless. Earlier in 2019, Boundless was purchased by Federal, and from this acquisition, [https://www.planet.com/ Planet Federal] was created. As a result, much of the work done by Boundless has been abandoned, including the OpenGeo Explorer plugin. Nevertheless, the plugin has been updated since the time the original tutorial was written, and so this revision of the tutorial will hopefully identify whether it works or not.
[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.
 
  +
OpenGeo Explorer is essentially a GUI (Guided User Interface) which serves as an easy and convenient way to transfer files between QGIS, and the GeoServer or PostGIS instance.
   
  +
=Getting Started=
==Database and Connection==
 
  +
  +
==Software Stack==
  +
Data exchange through a database can be accomplished through networks ranging from one local machine, to the internet. In order to achieve functionality of the QGIS/ OpenGeo database feature, some GIS and server setup are necessary. Client-side requires the [https://qgis.org/en/site/forusers/download.html current] version of QGIS (at time of writing this is 3.8 ‘Zanzibar’). Server-side should have the latest version of either [http://geoserver.org/download/ GeoServer], or [https://postgis.net/install/ PostGIS]. A functioning Python install is required, as well as basic knowledge of 'Command Prompt' commands. <br>
  +
  +
Individual configuration will be machine dependent.
  +
  +
==The importance of Database and Connection==
  +
  +
Establishing a database connection is important, as the OpenGeo Explorer can greatly enhance the QGIS experience. OpenGeo Explorer enables the user to publish their work to GeoServer, automatically converting from QGIS to the GeoServer format, and allowing for additional conversion to PostGIS, if necessary.
   
 
==Geospatial Data Storage==
 
==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.
 
   
  +
Access to data is a key part of GeoSpatial analysis. Without data, no analysis can occur. This is where having access to a database, or database[s] comes in handy. Processed data can be uploaded for future use by the creator, or allow others to save time by using data which has already been refined. This data can then be utilized and worked on by multiple users, or groups. This also helps to ensure that the data remains current, as it is not solely on the creator to routinely update, and refine it.
==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.
 
# In the main menu go to ''Plugins > Manage and Install Plugins...''
 
# In the ''Plugin Manager'' window go to ''Settings'', check ''Show also experimental plugins'', and press ''Add...'' to specify new repository
 
# Enter name and URL of repository, where URL is http://qgis.boundlessgeo.com/plugins.xml (there also is a repository at GitHub), press ''OK''<br><br><center>[[Image:Fig1_01.jpg|600px|]]<br>''Add new repository dialog window''</center><br>
 
# Navigate to ''Get more'' in same Plugin Manager window and highlight OpenGeo Explorer from the list - press ''Install plugin''
 
# Make sure that OpenGeo Explorer is checked under ''Installed'' tab and close ''Plugin Manager''
 
# New section in the main menu called OpenGeo should appear, which provides tool's switch, settings, and help
 
   
  +
=Installation=
===Setup===
 
  +
OpenGeo Explorer now requires a more ‘code-heavy’ install as it is considered deprecated. This requires the use of command line to install a couple of python programs. After hours of testing I could not get it to function but have included the commands here for anyone looking to try. The latest version of OpenGeo Explorer can be downloaded [http://qgis.boundlessgeo.com/plugins/packages/geoserverexplorer.0.6.zip here.]<br>
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.
 
  +
NOTE: A python installation is required before attempting.
<center>[[Image:Fig1_02.jpg|600px|]]
 
''Tree view: GeoServer catalogs, PostGIS connections, and current QGIS project layers''
 
   
  +
In Command Prompt:
[[Image:Fig1_03.jpg|600px|]]
 
  +
''Tab view: GeoServer catalogs, PostGIS connections, and current QGIS project layers''</center>
 
  +
pip install paver
  +
  +
The above command installs paver, from here you need to install OpenGeo Explorer:
  +
  +
$ paver setup
  +
$ paver install
  +
  +
As I could not get it to function, nothing beyond this point has been updated for anything technically related.
  +
  +
==Setup==
  +
  +
The plugin contains a GUI in the form of scalable window which can be snapped to the margins of the QGIS window. It is divided into two areas: ''Connections tree'', and ''Actions'' list.
  +
  +
<center> [[Image:Fig1_02.jpg|600px|]]
  +
Tree view: ''GeoServer catalogs, PostGIS connections, and current QGIS project layers''
  +
</center><br><br>
  +
  +
<center> [[Image:Fig1_03.jpg|600px|]]
  +
Tab view: ''GeoServer catalogs, PostGIS connections, and current QGIS project layers''
  +
</center><br><br>
  +
  +
A GeoServer connection can be established by highlighting ''GeoServer catalogs'' in the connections tree, and selecting either the ("+") button or ''New catalog...'' link in the actions menu at the bottom.
  +
Once the ‘Catalog definition’ dialog opens, ensure the information is entered exactly how it appears in the server records. If a catalog has successfully connected, then tree will expand to include ''Workspaces'', ''Layers'', ''Groups'', ''Styles'', ''WPS processes'', and ''Settings''
   
'''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''
 
 
<center>[[Image:Fig2_01.jpg|500px|]]
 
<center>[[Image:Fig2_01.jpg|500px|]]
''New GeoServer connection dialog window''</center><br><br>
+
''New GeoServer connection dialog window''
  +
</center><br><br>
  +
  +
'''PostGIS''' connections are added in the same way. However, the ''Create new PostGIS connection'' dialog is structured slightly different. Once added, newly established connections provide access to the schemas available in the
  +
database.
   
'''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.
 
 
<center>[[Image:Fig2_02.jpg|500px|]]
 
<center>[[Image:Fig2_02.jpg|500px|]]
 
''New PostGIS connection dialog window''
 
''New PostGIS connection dialog window''
 
</center><br>
 
</center><br>
   
===Data transfer===
+
==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.
 
  +
The addition of OpenGeo Explorer within QGIS, simplifies the access to the database. The layers can be processed, uploaded to the database, and then downloaded again. Deleting and importing of files in the database are enabled through the tool.
[[Image:Fig2_03.jpg|650|]]
 
  +
''Working view of OpenGeo Explorer''<br>
 
  +
<center> [[Image:Fig2_03.jpg|650|]]
For '''QGIS to Database''' transfer take following steps, assuming that at least one layer is present in QGIS project:
 
  +
''Working view of OpenGeo Explorer''
  +
</center><br><br>
  +
  +
===To transfer from QGIS to a database:===
 
# Highlight the required layer under ''QGIS project'' in OpenGeo Explorer
 
# Highlight the required layer under ''QGIS project'' in OpenGeo Explorer
# Choose and click either ''Publish to GeoServer...'' or ''Import into PostGIS...'' in ''Actions'' list
+
# Select either ''Publish to GeoServer...'' or ''Import into PostGIS...'' in the ''Actions'' list
# Fill out required information in the prompted dialog window
+
# Enter the required information when prompted
<center>
+
<br><br>
  +
[[Image:Fig3_02.jpg|600|]]
 
  +
<center> [[Image:Fig3_02.jpg|600|]]
 
''Import dataset to GeoServer dialog window''
 
''Import dataset to GeoServer dialog window''
  +
</center><br><br>
   
[[Image:Fig3_01.jpg|600|]]
+
<center> [[Image:Fig3_01.jpg|600|]]
 
''Import dataset to PostGIS dialog window''
 
''Import dataset to PostGIS dialog window''
</center>
+
</center><br><br>
   
  +
===To transfer from a database to QGIS:===
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.
 
  +
  +
# Click and drag a selected layer from the OpenGeo Explorer window to the ''layers'' tab within QGIS,
  +
NOTE: These instructions assume that at LEAST one layer is present in a QGIS project.
   
==Grid Layer Storage==
 
 
</td></tr></table>
 
</td></tr></table>
   
==Conclusion==
+
=Conclusion=
  +
  +
Please see write-up.
  +
  +
=References=
  +
  +
Installation - OpenGeo Suite 4.8. (n.d.). Retrieved from [http://93.187.166.52:8081/opengeo-docs/qgis/explorer/install.html] <br>
   
  +
Chan, N. (2019, February 13). GeoServer Plugin. Retrieved from [https://github.com/planetfederal/qgis-geoserver-plugin]<br>
==References==
 
   
  +
(BoundlessGeo), V. O. (2017). GeoServer Explorer. Retrieved from [http://qgis.boundlessgeo.com/plugins/packages/geoserverexplorer.0.6.zip]
Geomatics
 

Latest revision as of 22:12, 3 October 2019

Background

What is QGIS?

QGIS is a free, and Open Source Geographic Information System. An alternative to the standard, but expensive ArcGIS. QGIS is an official project of OSGeo (Open Sourse Geospatial Foundation). The system is regularly updated, and is supported on Linux, Windows, and MacOS. It boasts an extensive community who regularly improve the system, as well as adding new features. This tutorial will focus on a Windows specific setup.

OpenGeo Explorer

OpenGeo Explorer is a plugin which was originally developed by Boundless. Earlier in 2019, Boundless was purchased by Federal, and from this acquisition, Planet Federal was created. As a result, much of the work done by Boundless has been abandoned, including the OpenGeo Explorer plugin. Nevertheless, the plugin has been updated since the time the original tutorial was written, and so this revision of the tutorial will hopefully identify whether it works or not. OpenGeo Explorer is essentially a GUI (Guided User Interface) which serves as an easy and convenient way to transfer files between QGIS, and the GeoServer or PostGIS instance.

Getting Started

Software Stack

Data exchange through a database can be accomplished through networks ranging from one local machine, to the internet. In order to achieve functionality of the QGIS/ OpenGeo database feature, some GIS and server setup are necessary. Client-side requires the current version of QGIS (at time of writing this is 3.8 ‘Zanzibar’). Server-side should have the latest version of either GeoServer, or PostGIS. A functioning Python install is required, as well as basic knowledge of 'Command Prompt' commands.

Individual configuration will be machine dependent.

The importance of Database and Connection

Establishing a database connection is important, as the OpenGeo Explorer can greatly enhance the QGIS experience. OpenGeo Explorer enables the user to publish their work to GeoServer, automatically converting from QGIS to the GeoServer format, and allowing for additional conversion to PostGIS, if necessary.

Geospatial Data Storage

Access to data is a key part of GeoSpatial analysis. Without data, no analysis can occur. This is where having access to a database, or database[s] comes in handy. Processed data can be uploaded for future use by the creator, or allow others to save time by using data which has already been refined. This data can then be utilized and worked on by multiple users, or groups. This also helps to ensure that the data remains current, as it is not solely on the creator to routinely update, and refine it.


Installation

OpenGeo Explorer now requires a more ‘code-heavy’ install as it is considered deprecated. This requires the use of command line to install a couple of python programs. After hours of testing I could not get it to function but have included the commands here for anyone looking to try. The latest version of OpenGeo Explorer can be downloaded here.
NOTE: A python installation is required before attempting.

In Command Prompt:

   pip install paver

The above command installs paver, from here you need to install OpenGeo Explorer:

   $ paver setup
   $ paver install

As I could not get it to function, nothing beyond this point has been updated for anything technically related.

Setup

The plugin contains a GUI in the form of scalable window which can be snapped to the margins of the QGIS window. It is divided into two areas: Connections tree, 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



A GeoServer connection can be established by highlighting GeoServer catalogs in the connections tree, and selecting either the ("+") button or New catalog... link in the actions menu at the bottom. Once the ‘Catalog definition’ dialog opens, ensure the information is entered exactly how it appears in the server records. If a catalog has successfully connected, then tree will expand to include Workspaces, Layers, Groups, Styles, WPS processes, and Settings

Fig2 01.jpg

New GeoServer connection dialog window



PostGIS connections are added in the same way. However, the Create new PostGIS connection dialog is structured slightly different. Once added, newly established connections provide access to the schemas available in the database.

Fig2 02.jpg

New PostGIS connection dialog window


Data transfer

The addition of OpenGeo Explorer within QGIS, simplifies the access to the database. The layers can be processed, uploaded to the database, and then downloaded again. Deleting and importing of files in the database are enabled through the tool.

Fig2 03.jpg

Working view of OpenGeo Explorer



To transfer from QGIS to a database:

  1. Highlight the required layer under QGIS project in OpenGeo Explorer
  2. Select either Publish to GeoServer... or Import into PostGIS... in the Actions list
  3. Enter the required information when prompted



Fig3 02.jpg

Import dataset to GeoServer dialog window



Fig3 01.jpg

Import dataset to PostGIS dialog window



To transfer from a database to QGIS:

  1. Click and drag a selected layer from the OpenGeo Explorer window to the layers tab within QGIS,

NOTE: These instructions assume that at LEAST one layer is present in a QGIS project.

Conclusion

Please see write-up.

References

Installation - OpenGeo Suite 4.8. (n.d.). Retrieved from [1]

Chan, N. (2019, February 13). GeoServer Plugin. Retrieved from [2]

(BoundlessGeo), V. O. (2017). GeoServer Explorer. Retrieved from [3]