Joseph Kariuki

HCMGIS Featured Picture

Working With HCMGIS QGIS Plugin: Part 2

This is the second part in working with the HCMGIS QGIS Desktop plugin that is rich with functionalities and to check out the first part of thewalkthrough click the link shown Working with HCMGIS QGIS Plugin Part 1

The walkthrough continues below with more functionalities.

Download Covid-19 Data

The third tool is for downloading Covid-19 data which can be used to create heatmaps showing and performing analysis on data with respect to covid-19. Click on Download Covid-19 Data shortcut under it select the first submenu shortcut as shown below.

Download covid -19 data menu

This downloads and displays covid-19 data from the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University Hopkins data repository. The downloaded data appears as shown below in QGIS Desktop map canvas.

Covid19 data loaded in QGIS Desktop as points representing countries

The map below shows covid-19 data for African countries with each dot representing country or sovereignty.

Loaded covid-19 data in Africa continent

Below is the attribute table for the covid-19 point layer. Note the Country_Region column containing names of countries.

Covid-19 layer attribute table

While still in the attribute table, identify and click on the icon on top of the attribute data that contains an epsilon label as shown below. 

Select by expression shortcut and tooltip in covid-19 layer attribute table

This opens selection window which will be used to demonstrate selection in QGIS Desktop by use of expression. For details on QGIS expressions refer to the QGIS Documentation.

Select by expression widget in QGIS Desktop

The intention here is to select points representing countries with covid-19 cases that are beyond a given value. The first step will be to identify the field/column that contains the value of our interest. In this case identify the Fields and Values and double click to collapse it and select Active by double clicking on it as well. 

Note that the double clicked field name will appear in the left text area containing double quotes. Note that all fields in QGIS expressions are represented like the one shown below. Add a greater than sign ‘>’ as shown below and add a value like 100000 as shown below.

Fields and Values filter

Ensure that the expression window’s bottom left area is clear of any errors that can be indicated in red and then click Select Features button at the bottom right area of the window. 

If the attribute table had been closed, open it and the selected fields will appear as shown below.

Similarly in the map, some of the points have been selected (in yellow) and represent countries that have active cases of over 100000.

Output

In summary, we have been able to visualize covid-19 data using HCMGIS plugin and filtered the data to select only countries that have over 100000 active covid-19 cases. This is a case example among others that HCMGIS plugin can be used.

Download Open Data

Browsing for GIS data online, identifying it, downloading and extracting it can be time consuming and at times exhausting. HCMGIS plugin’s Download OpenData functionality can save some time on this and also provide up-to-date data for those repositories that update their data.

To download data from geofabrik, click on the first option under Download OpenData shortcut labelled OSM Data ye Country from Geofabrik. Geofabrik, as explained in a recent post on downloading geospatial data is an open street map data repository through which one can download data from.

Download data from geofabrik

On clicking the shortcut a windows is displayed and appears as shown below. It contains various controls for selection and buttons.

Download data from Geofabrik widget

Click on the first drop down that contains representation of world regions. For this case, Africa region would suffice otherwise any other region can be selected.

Selecting country in download data from geofabrik

The next step entails selecting a country within Africa region selected above. Sao Tome and Principe is the selected country as shown below. Note that different countries have different sizes of datasets and the bigger the data, the more the time it will take to download the data.

Selected region and country in downloading open data from geofabrik

Use the browse button labelled to navigate to he folder where the downloaded data will be saved. Select a suitable location in the local computer. A message will show informing on the size of data to be downloaded and that it may take time. The message is as shown below.

Message indicating the size of the data being downloaded

Once the download is complete, the download progress bar will be full and at 100% as shown below.

Download complete progress bar

After download a success message will be shown as well indicating that the download has been completed successfully.

Download success message

The downloaded data will automatically be loaded in the QGIS Desktop layers panel and in the map canvas as shown below. for Sao Tome and Principe.

Similar to previous steps, the attribute table of the data can also be opened and for this case, the attribute table appears as shown below.

In summary, HCMGIS plugin can be leveraged to download data from Geofabrik, an Open Street Map data repository o-the-fly into the machine and visualized.

Download GADM data

The other open data download supported include data from Global ADMinistrative areas repository which can be accessed from this link.

Click on the shortcut shown below to download data from GADM repository.

A window containing download options in controls appears as shown below. To begin, click on country drop down.

Download data from GADM widget with controls

The drop down shows list of all countries in the world. Select your preferred country as in this case, the selected country is Kenya. as shown below.

Country selection drop down

A message showing the shapefile size to be downloaded and informs that the download may take time. Click Yes button to continue.

File size message informing that it would take some time to download

Once the download has started, the progress bar starts to change by increasing percentage value as the download continues in the background. Once the download has completed, the progress bar is at 100%.

Progress bar indicating that download has been completed successfully

A message is shown once the download is complete informing that the download process has completed successfully or with error. Click OK button to continue.

Download success message indicating that the data is to be extracted

Another message similar to the messages above shows informing that the extraction of the data has completed successfully. Click OK to proceed.

Completion message

The downloaded data is displayed in the QGIS map canvas and has several administrative levels. The one shown below is the administrative level zero of the whole country. Note that in the Layers panel there are four layers representing the administrative levels.

Downloaded data displayed in QGIS map canvas

Disable all the layers by unchecking the checkboxes in the Layers panel except for the layer labelled gadm36_KEN_1 which will be shown in the map canvas as below. This is the administrative level 1 representing the counties of Kenya.

Downloaded data displayed in QGIS map canvas

To view the attribute table right click on the active (checked) layer and click Open Attribute Data option shown below.

Open Attribute Table in QGIS Desktop

The attribute table for the layer will be displayed and appears as shown below.

Downloaded data attribute table displayed in QGIS Desktop

In summary, the plugin saves the time that would take to navigate to download page using browser to download like in a previous procedure and also extracts and visualizes the data in QGIS Desktop.

Building Footprints from Microsoft

HCMGIS plugin supports spatial dataset download from Microsoft Building footprints data repository. The repository can be accessed through their GitHub repository. To access the functionality, click on the shortcut as shown below.

Building Footprints from Microsoft shortcut in HCMGIS plugin

A window containing controls for country, province/state, file size and number of buildings among others appears as shown below. Click on the country drop down.

Building Footprints from Microsoft widget in HCMGIS plugin

The only available option in this case is United States and under it select Alaska state. After selecting the above, then the number of buildings and file size is displayed in their corresponding text areas. Also ensure that the preferred save folder is selected. Click on Apply button to poceed.

Building Footprints from Microsoft widget with selected items in HCMGIS plugin

A confirmation  message similar to previous ones appears as shown below. Click Yes button to proceed.

Download file size message

Once the download is complete, a message box similar to others in previous steps is shown indicating that download has been completed. Click on OK button below.

Success dowload message in HCMGIS

After extraction another message box is shown and appears as below. Click OK button to proceed.

Success dowload message in HCMGIS

The downloaded data is visualized in the QGIS map canvas and appears as shown below. The data consist of buildings spanning across the state of Alaska. 

Downloaded data display in QGIS Map Canvas

Download Other Open Data

HCMGIS plugin supports dowloading of other data from the web through the Web Feature Service (WFS) which is an Open Geospatial Consortum (OGC) standard. Click on the the shortcut as shown below.

HCMIS OpenData and more... shortcut

A window is displayed and contains controls based on the WFS specification such as the title and abstract which populate on selecting a supported service provider. 

HCMIS OpenData widget

The supported service providers appear as shown below on clicking the Service Provider drop down.

HCMIS OpenData widget WFS drop down

One of the service providers is the HCMGIS OpenData and when selected, the abstract, title and WFS layers sections are populated and appear as shown below. This gives the user the chance to select an individual layer of interest for download.

HCMIS OpenData widget WFS details shown

Change the service provider to World Food Programme as shown below. 

The WFS layers will change on changing the service provider. After selecting the provider, identify any layer on the WFS layers list. Note that the selected option is named geonode:food_insecurity at number 11.

Once that is selected, click Browser… button to point to the output folder where the data will be downloaded into.

Select SHAPE-ZIP as the output format which instructs the plugin to download data in the format of a zipped file.

The screenshot below shows the selected dataset of our interest.

Once Apply buton is clicked, the progress bar is activated and shows the download size in percentage. Once it completes, the progress bar appears as shown below, also the number of layers being downloaded is shown.

The data that has been downloaded appears in the QGIS map canvas as shown below.

The attribute table for the downloaded data appears as shown below.

In summary, the HCMGIS QGIS Desktop plugin can be leveraged in different ways based on users interest and can help achieve some user’s goals. Try the plugin for yourself and use different options and different datasets. 

HCMGIS Featured Picture

Working with HCMGIS QGIS Plugin

In a recent post we had a walkthrough on the QuickMapService plugin and in this post we shall look into a multifunctional plugin called HCMGIS. that can come in handy with various desktop GIS workarounds as we shall see in the following sections below.  

About HCMGIS Plugin

HCMGIS is a QGIS Desktop plugin that has been developed by Center for Applied GIS of Ho Chi Minh City and the code repository for the plugin can be accessed through this GitHub link and comprises of the following functionalities:

  1. Basemaps loader.
  2. Batch Converter for some GIS data formats.
  3. Downloader for Covid-19 Data.
  4. Downloader for datasets from various platforms.
  5. Downloader for Vietnam datasets.
  6. Geometry Processing tool.
  7. Calculate Field tool.

In this walkthrough we shall only look at the first four functionalities.

Installing HCMGIS Plugin

To install HCMGIS QGIS plugin, one can either download a zipped file from the HCMGIS Plugin repository or download directly from the QGIS Desktop Plugins menu. Below is a screenshot of the HCMGIS plugins repository for the HCMGIS plugin.

HCMGIS QGIS Plugin Repository home page

This walkthrough assumes that QGIS Desktop is already installed in the computer. If not, refer to the post on Installing QGIS Desktop in Windows 10 . This walkthrough has been done in Windows 10. After opening QGIS Desktop and installing the HCMGIS plugin, the plugin menu under installed section should appear as shown below.

Installed HCMGIS QGIS Plugin in QGIS Desktop

The menu should also be visible in the QGIS menu as shown below.

HCMGIS QGIS Menu Shortcut

When clicked the shortcuts under it appear as shown below. The items functions are as highlighted in the previous section.

BaseMap

Click on the BaseMap shortcut and the dropdown appears showing a list of all the basemaps supported by the plugin. Note that you require to be having an internet connection to load the basemaps as they are being loaded from the web. 

HCMGIS supported basemap services

Under BaseMap shortcut, click on the GoogleMaps option and a map is loaded in the QGIS Map Canvas and on the Layers Panel as a layer if active as shown below and is zoomed into Kenya’s bounds. The service is developed and maintained by Google.

Google BaseMap loaded from the HCMGIS plugin

When done with the above base map, close and click on the HCMGIS plugin once again and click on the  Bing Virtual Earth option and the base map loads showing a terrain kind of map that looks like natural landscape with green vegetation. The free service can be used to view features on earth’s surface.Bing Virtual Earth BaseMap as loaded from the HCMGIS plugin in QGIS Desktop

The next base map is the CartoLight base map which is maintained by Carto and can come in handy with custom data overlays or in designing a map in QGIS Desktop. There are other children of carto base maps that include Carto Dark and Carto Eco. Below is the Carto Light base map which is preferred for point data. The development repository can be accessed here.

CartoLight BaseMap as loaded from the HCMGIS QGIS Desktop

The final base map in this walkthrough includes the WikiMedia base map which appears as shown below. There are a variety of basemaps that can be used under the HCMGIS plugin and just a few have been covered here.

HCMGIS WikiMedia BaseMap as loaded from HCMGIS in QGIS Desktop

Batch Converter

Navigate to the GADM data repository page in your preferred web browser and download your preferred data. I this walkthrough we shall make use of Kenya ESRI shapefile for next steps.

GADM Geospatial data download page

After downloading the data, in the QGIS Desktop menu identify and click HCMGIS menu and if it is not visible revisit previous steps of opening the QGIS Plugin menu and activating or even re-installing the plugin otherwise, the clicking should show a dropdown that appears as shown below.

HCMGIS Batch Converter menu in QGIS Desktop

Click on the Vector Format Converter shortcut and this open a widget that appears as shown below and contains several controls; dropdowns, buttons and text fields. 

HCMGIS batch converter plugin widget in QGIS Desktop

Under the input format label is a drop down when clicked, shows all the supported input formats. In this case we will be working with ESRI shapefile denoted by SHP option therefore, select that option.

Supported input formats in the HCMGIS plugin

Similarly, under the output format label, select CSV as the option indicating that we shall be outputting our data in Comma Separated Value (CSV) file.

Supported output formats in the HCMGIS plugin

After selecting input and output formats, click on the Browse… button which will open an input folder window. Navigate to the folder containing the previously downloaded and extracted data and click OK button to close the window.

Input folder containing shapefiles to be converted by HCMGIS plugin

If pointed to the correct folder, the shapefiles existing in that folder will be shown as a list as shown below. The folder in this case contains four shapefiles.

HCMGIS widget containing the shapefiles to be converted

After ensuring all above mentioned options are correct, click Apply button to proceed with the conversion.

The apply button to be clicked to convert the shapefiles in HCMGIS plugin

After the conversion is complete, the progress bar will be at 100% and a label indicating number of files converted will be shown as below. If any errors occurred during conversion they will be displayed in the error log area below the progress bar. 

HCMGIS conversion progress bar showing the percentage progress of shapefile conversion..

The whole window appears as shown below after conversion.

Navigate to the output location that is similar to the input folder and additional files with a .csv extension will appear as shown below. They may be arranged by name or other field but the file type will be Comma Separated Values.

CSV files converted from shapefiles by the HCMGIS plugin in QGIS Desktop

On loading the layers in QGIS Desktop and opening the attribute table, the data looks as shown below.

Attribute table for one of the CSV file coverted from shapefiles using HCMGIS plugin

CSV to Point Converter

In this next step, we will select the CSV to Point shortcut as shown below. 

CSV to point conversion menu in HCMGIS plugin in QGIS Desktop

This tool geocodes CSV data and converts them to shapefiles which is quite the opposite of what we did in the previous step only that in this step the input and output formats are fixed.

CSV to Point widget

Click on Browse… button to browse to the directory containing input CSV files. The input files must contain coordinates fields in Latitude and Longitude otherwise the conversion will not take place. To mitigate this from happening, open the CSV data in a text editor or in QGIS Desktop to view the attribute data and confirm that it has coordinates.

The data used in this procedure can de downloaded from ArcGIS Hub data repository and is as listed below:

  1. Kenya Schools Kenya Open Data Initiative (KODI) – Download Link
  2. Kenya Towns – Download Link

Once the data has been downloaded navigate in the browse window shown below to the folder containing the files and click Select Folder button to close.

Input folder containing CSV files to be converted to point shapefiles

Now that the input folder has been selected, the next step entails identifying the latitude and longitude fields. At times the plugin automatically detects the fields and lists them as shown in the screenshot below but at times the user may be forced to click on the drop downs below the Latitude Field and Longitude Field consecutively to identify the actual field name containing the coordinates.

Batch CSV converter widget with CSV loaded from directory

Once selected every control as required, click Apply button to begin the conversion process. Once the process is complete the progress bar will be at 100%  and the number of converted files will be shown in bold above the progress bar.

CSV files conversion completed in batch CSV converter tool in HCMGIS QGIS plugin

The previously existing files in CSV can be identified as shown below.

Initial CSV files before conversion

The newly created ESRI shapefiles can be identified as shown below.

Converted files in shapefile from CSV

To add the layers, click on the Add Vector Layer… shortcut as shown below.

Adding Vector Layer in QGIS Desktop

The Data Source Manager window is displayed as shown below with the Vector option highlighted. Click on the button labelled to browse the file system.

QGIS Desktop's data source manager for adding data in QGIS

A file browser window similar to previous file browser windows is displayed as shown below. Point it to the files of interest and note that they end in .shp extension indicating that they are shapefiles and then click Open button.

File selection of files to import into QGIS Desktop

The shapefiles are loaded as vector layers and displayed in the QGIS map canvas as shown below.

Layer loaded in QGIS after conversion from CSV

In the QGIS Desktop Browser panel, identiy XYZ Tiles and double click on it to collapse it and among the options identify OpenStreetMap that comes with QGIS by default.

Loading OSM basemap from QGIS XYZ Tiles menu

This loads an Open Street Map base map however it appears on top of the vector layer therefore hiding the points and it is necessary to correct that.

OSM basemap layer loaded

In the layers panel shown below, drag the OpenStreetMap layer shown below by clicking and holding the mouse button downwards below the other two layers and it will appear as shown below.

Arranged layers in layers panel

And also for the map, the points will be seen to appear on top of the basemap.

Map with basemap and all layers loaded

In the above steps the conversion of datasets has been summarized and this shows that the HCMGIS plugin can come in handy and remove the repetitive process of converting multiple files by loading them into the QGIS Desktop and exporting them manually.

The walkthrough of the rich functions of the HCMGIS plugin  will proceed in the second part that is a continuation of this post and to proceed, click Working with HCMGIS QGIS Plugin Part 2.

QuickMapServices post featured image

Working with QuickMapServices QGIS Plugin

QGIS Desktop plugins extend the base functionalities of the GIS desktop software. On its own, QGIS Desktop can help users achieve a lot of tasks from digitizing, connecting to a database and creating of maps among others. Plugins enrich QGIS Desktop functionality and in this post we shall see our first example plugin that is the QuickMapService plugin. The tutorial highlights how to download, install and use the plugin.

QuickMapServices is a QGIS Desktop plugin that comprises of several web services, datasets and basemaps that can be used as a help to digitizing, comparing vector feature locations, change detection studies among many other tasks. It has been developed by NextGIS and its code repository can be accessed using this link. To install a plugin in QGIS Desktop, one can either download a zipped file from the QGIS Python Plugins repository or download directly from the QGIS Desktop Plugins menu. Below is a screenshot of the QGIS Plugins repository.

QGIS Desktop plugins website page

 

This tutorial assumes that QGIS Desktop is already installed in the computer. If not, refer to my post on Installing QGIS Desktop in Windows 10 and if using Ubuntu Linux refer to Installing QGIS Desktop in Ubuntu Linux this tutorial uses Ubuntu. Run the QGIS Desktop by clicking on the shortcut either pinned in the GNOME taskbar as shown below.

QGIS Desktop Shortcut on GNOME Taskbar

Alternatively, the QGIS Desktop shortcut can be accessed by clicking the home key in the keyboard (could be marked as a windows key) and type in the search area QGIS and the shortcut shall appear as shown below as long as one has QGIS installed in the computer.

QGIS Destop Shortcut alternative search result

After clicking the QGIS Desktop shortcut, then the splash screen is displayed for few seconds and appears as shown below. Note that the splash screen differs with the QGIS Desktop version installed in the computer.

QGIS Deskttop splash screen on an Ubuntu Desktop

After the splash screen disappears, the QGIS Desktop user interface is displayed and contains different controls and menus. The screenshot below shows the user interface in its default state and may differ with others if user interface settings have been customized. To understand the QGIS Desktop user interface, view my post on Exploring the QGIS Desktop User Interface .

The QGIS Desktop user interface

In the Menu Bar at the top just below the black title bar lies all the menus that are shown in the QGIS by default. Some plugins once installed populate or insert additional menus. Identify the Plugins menu that is between Settings and Vector menus above and click on it and the drop down containing a list of two menus pops down as shown below.

QGIS Desktop Plugins menu shortcut

Click the Manage and Install Plugins… shortcut which triggers a connection to the QGIS Plugins Repository shown at the beginning of this post but from the QGIS user interface.

Fetching QGIS plugins from repository

If the connection is successful then the plugins widget appears as shown below containing all the install-able plugins from the plugin repository. Otherwise a message box showing error in connection is displayed and the plugins menu shown will only have the QGIS core plugins under the Installed tab menu.

QGIS Plugins widget containing plugins

Click in the search bar at the top and type QuickMapService and the plugins will be filtered as typing continues and will finally show the plugin of our interest as shown below.

QuickMapSevice plugin search

Click on the Install Plugin button at the bottom right of the widget. If already installed then the buttons will be labelled Uninstall Plugin and another one labelled Re-install Plugin. Ensure that connection to the internet is working as it downloads the plugin files from the internet.

Once installed, ensure that the left checkbox is checked as shown below for the QuickMapServices plugin meaning that it will be active in the QGIS Desktop user interface.

QMS  checkbox is checked

Close the plugin widget and in the QGIS Desktop user interface, there will be a docked widget which for now can be closed since it is not being used in this task.

QMS docked widget

Identify and click the Web menu in the menu bar area and a dropdown appears as shown below. Hover the cursor on top of the QuickMapServices.

QuickMapServices menu shortcut

The drop down shows only five services however these could be very few for most usages and tasks. Therefore there would be need to add more services.

Luckily, instead of using an additional plugin or looking for web map services’ urls on the web which could be time consuming, QuickMapServices plugin has settings to add these extra services if they appear as shown above. On the plugin menus just below the services shown above, identify and click settings which is highlighted below.

QuickMapServices plugin settings menu

The settings comprise of a number of tabs in which the More Services tab is of our interest therefore click on it if not active and the contents will appear as shown below. Click on the button labelled Get contributed pack below.

QuickMapServies plugin settings widget

The additional services are installed from the internet and this process will only be successful if there is working internet connection otherwise an error in connection message will be shown.

Additional services downloaded successfully message

Click OK above and in the settings widget click on save button shown as below.

Save QMS settings button

To show the added services, click on the QuickMapServices menu under Web QGIS menu and they will appear as shown below.

QuickMapServices menu after download service pack

We shall begin by loading a Google Satellite base map by selecting the options as shown below.

Google Satellite option in Quick Map Services plugin

By clicking on the Google Satellite option, the layer from Google Satellite is loaded on the QGIS map canvas area and on the layers panel all as shown below.

Google Satellite layer loaded in QGIS Desktop

One can also zoom into the image and an example of the layer display after zooming in appears as shown below. The area shown is a part of Lake Victoria located in western part of Kenya in East Africa region.Google Satellite layer zoomed inThe second service to load will be ESRI Satellite basemap that appears under the ESRI option as shown below.

ESRI Basemap service in QMS plugin

On selecting the ESRI Satellite option, the basemap is loaded as a layer in the QGIS map canvas just like in the previous step. It may seem somewhat similar but also with some differences to the previous but the provider (ESRI in this case) is different.

ESRI Satellite basemap layer

The final service that we will load in this tutorial will be Stamen Terrain whose options appear as shown below.

Stamen Terrain Layer in QMS plugin

On selecting Stamen Terrain, the layer is visualized in the QGIS map canvas layer and is as shown below. As it can be noticed, the style of the layer below is different from the previous layers.

Stamen Terrain layer in QGIS Desktop

 

We have been able to install QGIS plugin named QuickMapServices and can come in handy for tasks such as having a base map layer for map, digitizing of features from layer and Geo-referencing tasks just to mention a few. This plugin is also flexible on the number of services that on e can work with therefore give it a try.

Creating ubuntu 20.04 VM in VirtualBox

In a recent post, we installed Oracle VM VirtualBox in Windows10 and in Ubuntu Linux operating systems. In this post we shall create a new Ubuntu 20.04 Virtual Machine (VM) in VirtualBox which attempts to help persons who are beginners in using Oracle VM VirtualBox and others who would probably want to perform tests in an isolated operating system from the one residing in their personal computers. This post assumes that Oracle VM VirtualBox has been installed successfully and if not, refer on how to install VirtualBox by clicking here.

Downloading Ubuntu Desktop ISO Image

To create Ubuntu VM, the first step is to navigate to the Ubuntu Desktop download website by clicking here. The page appears as shown below in the browser.

Click on the green button shown above labelled Download to download the Ubuntu 20.04 optical disk image (ISO) which will be our input requirement to VirtualBox.

Creating Ubuntu VM

After downloading Ubuntu Desktop image, open VirtualBox from the desktop shortcut shown below and right click and select Open option.

The VirtualBox window is displayed consisting of some menu items on the menu bar. Click on File option which contains various configurations/settings for VirtualBox.

To view the help info for VirtualBox, click the Help menu which contains links to the VirtualBox website and community forums as shown below and about info that shows the VirtualBox version.

To open VM options, click on Machine menu and a list of two options appear as shown below. To create a new VM click on New… option.

A wizard is shown as below containing name field for the name of the VW to be created, Machine Folder: for the path to the directory which will contain the VM and its files, Type: for the type of the operating system that could be Windows, Linux, Mac etc., Version: that is a drop down for the OS versions.

Note that the name is mandatory and therefore cannot be blank. Then there is a button labelled Expert Mode that can be used to show detailed VM configuration but in this post we will just keep it simple. 

After entering the name, and the machine folder path, select the type by clicking the combobox and a dropdown pops as shown above. Since we are going to use Ubuntu OS which is a Linux based OS then select Linux option.

The above figure shows all the options having either been input (name) or selected as required. 

Ubuntu Desktop version 20.04 LTS has prerequisites that define the amount of memory and processing that the OS needs in order to run. This information is listed in their website and can be accessed by clicking here. In the setup the set RAM amount is 4 GigaBytes (GB) equal to 4096 MegaBytes (MBs). After setting this using the slider shown above, click Next to proceed.

This page entails creating a virtual disk in which the OS will be installed in. According to the Ubuntu community documentation, at least 25GB of hard disk is required for Ubuntu version 20.04. Ensure the middle option is selected (black dot inside the radio button) then click Create button to proceed with disk creation.

There are different types of Virtual Disks that can be used with VirtualBox. For details on the types refer the VirtualBox documentation by clicking here. Leave the selected option above as is and click Next to proceed.

One can configure on whether to create the whole physical disk space or not and this page gives the liberty to do so. In this post, the default selected option is left as is. Click Next to proceed.

The page shown above contains a slider similar to the previous one that one can use to decide the size of the virtual disk and an input for the path to the VM disk above it. To change the path click on the folder icon with green upward pointing arrow. Note not to set a disk size that exceeds your own disk even if the installation wizard might warn you of such as that would not be practical to add a disk size larger than computer’s own disk. Once finished, click Create to proceed.

The VM setup wizard disappears and takes us back to the VirtualBox main window but with a new VM whose name appears in the blue row as shown above. For more subsequent VMs that are created, they are shown in that column as a list.

A few extra configurations can be done on the VM. To open the configuration for the VM, right click on the VM and select Settings… option. 

The VM settings window shows and the default selection is General. Click on the System option to open the relevant system configuration options.

A panel containing three tabs is displayed as above, click on the Processor tab which is the middle tab as show above. The green bar indicates the allowed threshold/level of CPU processor that can be used i.e. in the above case, one cannot exceed 4CPU processors and if the slider is set over the threshold point then there will be a warning shown at the bottom part of the window. The set processor core count is set to 2 as indicated by the number in the right side of the slider. 

Click on the display to see the settings for VM display. It is optional to set video memory as it is automatically set in some cases. Adjust appropriately and click OK button to close the settings window.

On the main window, select the VM name and click on the green arrowed button to start the VM. 

Since this is the first time the VM is being run, then we have to select the disk image that is supposed to boot up / start up the VM but only for this first time. Click on the folder icon on the right of the Empty drop down to browse the computer files for the Ubuntu VM that we had downloaded earlier.

An Optical Disk Selector window is displayed as shown above where we can select the disk image from a list of disks shown however since we had not selected any disk earlier, no disk is shown in the white space area.

Click on the Add button to browse the computer files.

Navigate in the browse widow to the location of the Ubuntu image that we’d downloaded earlier. 

After selecting it and clicking Open button, the disk is now shown in the wizard as shown above. Click Start button to proceed.

The first installation procedure since version 20 is to check on the disk for any errors. As instructed, to cancel this process click Ctrl+C on your keyboard to cancel this step otherwise, let the disk check process to complete.

The installation wizard is shown containing a language selection as the first page. Select your preferred language and click Continue button.

Set your keyboard layout or if unsure, click Detect Keyboard Layout button to automatically detect keyboard layout then click Continue.

For the settings above, leave as is and click Continue.

For simplicity purpose, select the option as shown above to erase/format the disk and install Ubuntu OS.

The above pop up shows the disks and partitions that are going to be affected. Ubuntu uses EXT file system format for disks unlike in Windows. Click Continue.

This window shows the location of the computer as detected by Ubuntu. If using a Virtual Private Network (VPN), the map might show a different location. Click Continue.

Create a preferred name and computer name. Note that names should follow a given format and this can be referred to in the Ubuntu documentation. After entering name, computer name and password and leaving the rest as is, click Continue button.

The installation of Ubuntu 20.04 begins and is shown using a progress bar or a black ‘terminal’ window with text that keeps on changing. In the background the installation is downloading some files from the internet (if host computer is connected to the internet). This step may take some time depending on the processor and memory size allocated to the guest computer.

Once the installation is complete, the installation window with the progress bar closes and a window appears asking to restart the VM or continue. Click on Restart Now.

After restarting, the screen shown above appears showing the user that we created in the previous step. Click on the user on the screen i.e. in the screen above, lets click on ubuntu which is the user that was created in the previous steps.

Enter the password set during the user creation step. This is the final step in creating Ubuntu VM in VirtualBox. Note not to forget the password. 

At this stage, we have successfully created and installed an Ubuntu 20 VM in Oracle VM VirtualBox. 

Installing Oracle VM VirtualBox in Windows 10

Oracle VM VirtualBox is an open source Virtual Machine (VM) management software that is used to create and manage VMs. VirtualBox has been developed by Oracle software company and this post shows a step-by-step procedure on how to install VirtualBox in Windows 10 operating system. This post targets persons with interest in virtualization of OSs or those who would want to perform tests in operating systems that is different from the ones installed in their computer. 

Pre-requisites
  1.  Operating system with Virtualization enabled. The host machine/OS (your PC’s OS) should have virtualization enabled.
  2.  Guest machine’s hardware specifications. For example, if installing Windows 10, the pre-requisites for the OS should be adhered to to avoid issues like crashing due to less memory or space.
Checking for Virtualization in Windows 10

To check for virtualization in Windows 10, log into your Windows PC and right click on the taskbar and the following menu appears.

The menu items on the left consists of settings and customizations of the Windows Task Manager. Click on the Task Manager option to open the Windows Task Manager window.

Our interest is checking on the status of virtualization of the operating system.

 

 

 

The task manager is displayed and appears as shown below. It contains various tabs at the top for services and performance among others. Click on the Performance tab to show the machine’s CPU power, RAM and network usage among others. The performance tab appears as shown below.

 

Note the text circled in red. It indicates whether the virtualization is enables. If not then the computer cannot run VirtualBox and create VMs and needs to be looked at. 

 

Downloading VirtualBox

Navigate in the browser to the Oracle VM VirtualBox’s download page here. The page contains different downloads arranged by supported platform. The download page appears as shown below.

Click on the Windows hosts link above to start downloading the Windows 10 setup. After downloading the setup appears in the file system as shown below. Right click the VirtualBox setup and click Open option as shown below.

An installation wizard appears providing steps for installing VirtualBox and appears as shown below.

The first page is the welcome page. Click Next to continue.

The page above shows different components that come shipped inside the VirtualBox installation setup and the location in which the installation files will be extracted to. To change the location of installation, click Browse button. All the options have been left as default in these steps. Click Next to continue.

Further, the setup shows other customizations on whether the startup menus and shortcuts should be created among others. The options have been left as default as shown above. Click Next to continue.

This page indicates that Oracle VM VirtualBox installer re-configures the currently existing network in order to accommodate setups own network settings. Since the network interfaces are important for connecting VMs with guest and the internet as well, we’ll select Yes button.

This page shows that the configurations of the installer have been completed. To install, click Install.

A green installation progress bar is shown indicating the installation progress level. During installation some pop up windows appear as shown below.

The confirmation for installing Universal Serial Bus (USB) support drivers for VirtualBox is shown first.

The confirmation for installing the network drivers for VirtualBox is also shown. On both popups one can choose whether to check the box next to ‘Always trust software from “Oracle Corporation” then click Install button to proceed with installation.

Once the installation is complete the final page shown above appears. To run VirtualBox immediately after installation, ensure the checkbox for stating VirtualBox is checked as shown above. Once checked, click Finish to close the installation wizard and run VirtualBox.

VirtualBox window appears as shown above and contains several menu items denoted by different icons. For details on the VirtualBox user interface, refer to the official Oracle VM VirtualBox documentation here.

Check the following post on creating a VM in VirtualBox.

Installing Python3 in Windows 10

Python is one of the most commonly used high-level programming language that was invented by Guido Van Rossum in 1991 and is maintained by the Python Software Foundation. One of the major contributors to Python’s rise to fame is its development which had emphasis on code readability and expression of concepts by programmers in fewer lines of code.

Python is a cross-platform software and its learning curve is somewhat smooth learning curve as compared to some other programming languages.

This tutorial highlights the steps taken in installing Python software in Windows 10 operating system and can act as a guide to those beginners who would like to try out the language and also those who might experience challenge in installing the software.  

Downloading Python

To download Python, navigate in your preferred browser to the download page in Python’s official website. When the web page opens it appears as shown below and contains a list of all the Python’s releases for Windows. Click on the first link labelled Download Windows Installer (64-bit)  which assumes that you are using a 64-bit computer otherwise you can download the 32-bit one. The latest version as of this tutorial is version 3.9.2.

The download session starts once the link above has been clicked. The browser being used below is Microsoft Edge therefore if one is using another browser the download window could look different from this one.

Once the download is complete, in open the file explorer and navigate to Downloads folder and the downloaded installer appears as shown below. Note the amd64 suffix that indicated that this is a 64-bit installer.

At this point we have been able to successfully download python installer in the Windows machine and the next step will be to install Python.

Installing Python

To install Python, double click the downloaded installer or alternatively right click and select the first option labelled open and the installation wizard will appear on the screen as shown below. Click on the Customize installation option.

This page shows several options among them being to install with the default settings and to customize the installation.  The important thing in the window above is to ensure that the second checkbox is checked as shown thus ensuring that Python is added to the windows path.

On clicking the customize option, the installation window displays all the optional features and gives the user the liberty to check and uncheck the options shown. Leave the checkboxes as they are and click Next button. 

The window showed below contains the list of advanced options for installation and the text besides the checkboxes explains what each option does and below it the path to the directory of installation. Once satisfied with the options, click Install button.

On clicking Install button above, the installation process begins and the progress of the installation is indicated by the green progress bar shown below.

The installation process may take some minutes depending on the computer processing power and memory. When the installation has completed successfully, the following message is shown in the installation wizard. To view the online tutorials, documentation and the new Python features click on each of the links consecutively, otherwise click Close button to close the installation wizard.

 

After closing the installation wizard, click on the start button on your keyboard that in most cases is a key that has a Windows logo icon on it and type Python and by default, Windows filters the items with the name and the item of our interest in this is the option that has the python console icon as shown below. 

Click on the icon shown above and a black window that looks similar to the Windows Command Prompt (CMD) appears as shown below. This window is referred to as the Python Console and the consist of three symbols >>> and a blinking cursor. 

The Python Console can also be referred to as the Python Interactive Shell or the REPL standing for Read Evaluate Print Loop. It is an interactive window that one can type in commands and it shows an output. An example of the interactivity is demonstrated in the shell below. Once your Python shell is open, then type the following line of code.

print('Hello world')

And it shall print out Hello world text as shown below.

We have been able to install and run Python in this tutorial. For more detailed documentation on Python visit the Python Documentation.

 

HAPPY CODING

Deploying QGIS Server in Ubuntu 20.04

This tutorial guides users on how to install QGIS Server in Ubuntu Linux and provides a well illustrated step-by-step guide on the subject. QGIS Server is an open source GIS server that is used to publish geospatial data and maps across the web leveraging on Open Geospatial Consortium (OGC)’s services. Let us see how the software can be deployed in Ubuntu 20.04. This tutorial assumes that users have already installed Ubuntu 20.04 operating system in their computers.

Installing Pre-requisites

The installation procedure for installing QGIS Server in Ubuntu is somewhat similar to installing QGIS Desktop with just a slight difference between the install commands. There a re some libraries that are required prior to installing the software.

ubuntu login

After starting one’s computer that already has Ubuntu 20.o4 installed, the login screen shown above appears showing the user and a password field. Click on the password field and enter the preset password for the user and click enter key to login. Note that the password to be entered is the one set for the given user during installation.

ubuntu desktop user interface

On logging in successfully, the screen shown above appears showing the Ubuntu Desktop interface with the fossa-like image at the center of it. Click on the command key (similar to windows start key) on your keyboard and type ‘terminal’ as shown below.

ubuntu menu search

An icon with the name ‘terminal’ for the Ubuntu Terminal menu shortcut appears as shown above. This is the Ubuntu Terminal that we will be using to execute some commands.

update and upgrade

Run the command by typing the text shown below and click Enter key:

sudo apt update && sudo apt upgrade -y

which updates and upgrades consecutively outdated packages if any.  Otherwise it will run and show that zero packages were updated and/or upgraded.

update complete

Once the update and upgrading of packages is completed, the terminal window appears as shown above. To clear the terminal screen just type the command shown below and click Enter key.

clear

install qgis requirements

Prior to installing QGIS software, there are two packages that are required:

  1. gnupg – According to Debian Package Repository documentation, this package is used for secure data storage and communication and can be used to encrypt data and create digital signatures. QGIS installation alongside many other installations usually require digital signature verification, a method used to ensure authenticity of the software being installed.
  2. software-properties-common – According to the similar source as above, this package helps in allowing the user to easily manage their distribution and independent vendor software sources. At times it may be already installed in one’s operating system.

Type is the command shown below and click Enter key.

sudo apt install gnupg software-properties-common

The next procedure entails leveraging on the wget package to download and install the QGIS signing key. This will allow us to trust the QGIS installation. Copy and paste the following command in your terminal and click Enter key.

wget -qO - https://qgis.org/downloads/qgis-2020.gpg.key | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/qgis-archive.gpg --import

download gnupg keyAfter  running the command, the progress appears in the terminal as shown below.  Note the second and third last lines indicating that a total of 1 key has been processed and installed and this is the signing key.

The next procedure entails allowing read only permission to the QGIS signing key which leverages on the chmod command. The ‘a’ stands for User who is the owner of the file, the “+” sign grants the permissions (meaning grant permission), the ‘r’ stands for the read permission. Therefore in summary the following command assigns read permissions to all the users and groups to QGIS signing key.  For details on this refer here. Copy and paste the following command in the terminal and click Enter.

sudo chmod a+r /etc/apt/trusted.gpg.d/qgis-archive.gpg

In the next procedure we will be installing QGIS Server and the terminal will come in handy.

Installing QGIS Server

As a standard procedure while installing software in Ubuntu, the first step is to add the repository for the software to be installed in the system which is done by the add-apt-repository command. According to the Ubuntu Manpage website, this command adds the repository to the repository lists file. Another item to note in the command below is the text “[arch=amd64]” which tells the system that the installation being made is a 64-bit installation otherwise if your computer has a 32-bit architecture then no need to have it. Therefore, for 32-bit machines the command appears as shown below. Enter the command and click Enter.

Note: for 32-bit only

sudo add-apt-repository "deb https://qgis.org/ubuntu $(lsb_release -c -s) main"

and for 64-bit

sudo add-apt-repository "deb [arch=amd=64] https://qgis.org/ubuntu $(lsb_release -c -s) main"

Update the packages to ensure that libraries and dependencies necessary for QGIS Server installations are up-to-date.

sudo apt update

After updating the packages and libraries, the next step entails installing QGIS Server, QGIS Desktop and GRASS plugin as well. Note that you can just install QGIS Server only and not bound to install in this way however if you intend to use both desktop and server then you can stick to the command shown below.

sudo apt install qgis qgis-plugin-grass qgis-server -y

After successful installation, the terminal will be back to idle as shown below. Note that the installation process might take sometime depending on the computer processing speed.

For development of server plugins using Python, you can install the python-qgis package. This procedure is not mandatory to run QGIS Server and can be skipped otherwise copy and paste this command in the terminal and click Enter.

sudo apt install python-qgis

To test QGIS Server installation execute the following command in terminal and the resulting message will appear as shown in the image below.

/usr/lib/cgi-bin/qgis_mapserv.fcgi

QGIS Server requires a web application server to run and in this tutorial we will be using Apache Server. Another item required is the apache module called mod_fcgid whose work is to implement the FastCGI protocol that is used by QGIS Server and has advantage over the usual CGI protocol in that it can handle concurrent server requests and is also significantly faster then the latter. For more on FastCGI, refer to its documentation.

sudo apt install apache2 libapache2-mod-fcgid

We will create a site configuration file for QGIS Server. For every site one creates, it is mandatory to have a site configuration which is handled or processed by the Apache Web App server. To create a new configuration, we will use nano editor that comes with Ubuntu and through the command shown below. Paste the command in terminal and click Enter.

sudo nano /etc/apache2/sites-available/qgis_server.conf

The above command begins and edit session using nano editor. Note the GNU Nano 4.8 in the header line below. While in the edit session copy and paste the text below. Note that for each path shown as “/home/ubuntu/” needs to be corrected to your home directory path. For exmple, if your user is joseph then your home folder path is “/home/joseph/” therefore correct accordingly.

ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /var/www/html

# Apache logs (different than QGIS Server log)
ErrorLog ${APACHE_LOG_DIR}/qgis.demo.error.log
CustomLog ${APACHE_LOG_DIR}/qgis.demo.access.log combined# Longer timeout for WPS... default = 40
FcgidIOTimeout 120

FcgidInitialEnv LC_ALL "en_US.UTF-8"
FcgidInitialEnv PYTHONIOENCODING UTF-8
FcgidInitialEnv LANG "en_US.UTF-8"# QGIS log (different from apache logs)
FcgidInitialEnv QGIS_SERVER_LOG_FILE /var/log/qgis/qgisserver.log
FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0

FcgidInitialEnv QGIS_DEBUG 1

# default QGIS project
SetEnv QGIS_PROJECT_FILE /home/ubuntu/projects/world.qgs# QGIS_AUTH_DB_DIR_PATH must lead to a directory writeable by the Server's FCGI process user
FcgidInitialEnv QGIS_AUTH_DB_DIR_PATH "/home/ubuntu/qgisserverdb/"
FcgidInitialEnv QGIS_AUTH_PASSWORD_FILE "/home/ubuntu/qgisserverdb/qgis-auth.db"# Set pg access via pg_service file
SetEnv PGSERVICEFILE /home/ubuntu/.pg_service.conf
FcgidInitialEnv PGPASSFILE "/home/ubuntu/.pgpass"

# Tell QGIS Server instances to use a specific display number
FcgidInitialEnv DISPLAY ":99"

# if qgis-server is installed from packages in debian based distros this is usually /usr/lib/cgi-bin/
# run "locate qgis_mapserv.fcgi" if you don't know where qgis_mapserv.fcgi is
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews -SymLinksIfOwnerMatch
Order allow,deny
Allow from all
Require all granted

FcgidMaxRequestLen 26214400
FcgidConnectTimeout 60

 

After pasting the long configuration text, click Control and x keys at the same time i.e Ctrl + x keys on your keyboard which will show a prompt as shown below.

Click y key to accept changes made (Yes) and nano will exit back to terminal. The next step will be to make a directory for storing QGIS Server logs which are important in monitoring problems that might happen while it is running and also changing ownership of the created folder to apache that is indicated by www-data. Paste the command below in your terminal and click Enter key.

sudo mkdir -p /var/log/qgis && sudo chown www-data:www-data /var/log/qgis

We shall repeat the steps above but now creating a folder for the authentication database and changing ownership to apache (www-data).

sudo mkdir -p /home/ubuntu/qgisserverdb && sudo chown www-data:www-data /home/ubuntu/qgisserverdb

We shall now enable the FastCGI apache module using the a2enmod command that is used to enable apache modules and also enable the site configuration for QGIS Server that we had created in previous steps using the a2ensite command. The second command will prompt us to reload apache server.

sudo a2enmod fcgid && sudo a2ensite qgis_server.conf

let us reload the apache server to pick up the new configuration.

sudo systemctl reload apache2

QGIS Server requires xvfb library that is necessary to act as an X Server and uses the X11 display server protocol to run on machines that have no display hardware or physical input devices such as Ubuntu Server in a cloud infrastructure. Details on the library can be found in Debian’s xvfb documentation.

The next procedure is creating a service file for the xvfb library since it should run as a service. 

sudo nano /etc/systemd/system/xvfb.service

Paste the following lines in the file.

[Unit]
Description=X Virtual Frame Buffer Service
After=network.target

[Service]
ExecStart=/usr/bin/Xvfb :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset

[Install]
WantedBy=multi-user.target

Just like in the previous steps, ensure that you click Ctrl + x keys and then click y key and it shall resume the terminal.

We have already created a service but also need to run the service. To run the xvfb service run the following command in terminal.

sudo service xvfb start

We may need to check and ensure that the service is running without issues. To perform that task, we will run the following command in terminal. The green dot indicates that the service is running okay otherwise a white dot shows that the service is not running and in this case we might need to run or re-run the previous command.

sudo service xvfb status

So far we have enabled the QGIS Server site configuration and ensured that the necessary services are running. However, when installing apache for the first time it creates a default site configuration named 000-default.conf  and since we have created the custom configuration for QGIS Server website therefore we may need to disable the default configuration and remain only with QGIS Server site configuration. To do so, run the command below.

sudo a2dissite 000-default.conf && sudo service apache2 reload

Open the browser, in this tutorial we are making use of Firefox browser. open the following link.

http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

The link above opens an XML styled page indicating a error. The error is indicated by tags enclosing the error message as shown below.

Mostly for advanced terminal and apache server users, the logs can be employed to help the server administrator identify the exact error. We are not going to go into much detail on this however, the message shown in the screenshot below indicates that the file with a .qgs extension does not exist.

Download the dataset for this exercise from the QGIS GitHub repository.

A download message window will appear as shown below. Ensure the ‘Save File’ radio button is the selected one and click OK button.

Open the Downloads folder in your computer and the zipped donwload file will appear as shown below.

Open it and identify a folder named qgis-server-tutorial-data and enter into it and copy the items inside it to /home/$USER/projects folder.

Below is the projects folder mentioned in the previous step with all the elements copied into it. Note the world.qgs and world3.qgs which are QGIS project files.

On refreshing or re-opening the first link we had opened in the browser, the following XML page should appear as shown below. The file indicates server capabilities that are well defined in the OGC Web Services.

To view a map, navigate to the following link on your browser and an image map appears as shown below.

http://localhost/cgi-bin/qgis_mapserv.fcgi?MAP=/home/ubuntu/projects/world.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-432786,4372992,3358959,7513746&SRS=EPSG:3857&WIDTH=665&HEIGHT=551&LAYERS=countries&FORMAT=image/jpeg

Most of the items that make up the link are well defined in the OGC Standards such as the GetMap capabilities, Map location and format of the output which is a JPEG image. We have been able to deploy QGIS Server in Ubuntu 20.04 LTS and rendered a map from it on a browser. Comment or ask a question for clarity purpose.

Deploying QGIS Server in Windows 10

Installing QGIS Server in Windows 10

This tutorial or walkthrough is curated for those people who might want to install QGIS Server in their machines containing Windows 10 operating system or those that might be encountering challenges in installing the same. It consist of a step-by-step procedure with explanations that the usual setups and installation wizards might have or the information provided is little to make one understand.

QGIS Server is a an open source Geographic Information Systems (GIS) server that leverages on the Open Geospatial Consortium (OGC)’s services which include:

  1. Web Map Service (WMS)
  2. Web Feature Service (WFS)
  3. Web Coverage Service (WCS)

The above services have been well described in a previous post here. QGIS Server can be deployed in both Windows 10 and the steps below show how one can deploy/install the robust GIS server. A standard QGIS Server does not have specifications per-se and for such one can make reference to GIS StackExchange

Navigate to QGIS Installers web page at Download QGIS page using your browser. The web page looks as shown below.

Click on the OsGeo4w Network Installer (64-bit) for 64-bit computers and OsGeo4w Network Installer (32-bit) for 32-bit computers and this starts a download step.

Similarly, navigate using your browser to XAMPP Download Page that appears as below.

Click on the Download button. Note that there are only 64-bit downloads in the page above and this will also start a download process in the browser. Once the downloads are complete, the files appear in the file systam as shown below.

In this procedure, we will start with installing QGIS Server using the network installer. Double click the osgeo4w setup or right mouse click and select open option. This makes the installer wizard to appear as shown below.

Ensure the Advanced Install radio button is the selected one as above. This option grants the liberty to install individual Desktop and Server packages unlike the other two and in this case we only want to install the QGIS Server. Click Next button to proceed to the next wizard page shown below.

  

The option Install from Internet is for initial download (first run) which instructs the setup to download files from the internet into the computer and this is the step that we shall use. The option Download Without Installing just download files from the internet and does not install. The third option, Install from Local Directory is used when one has downloaded the files into a folder in local computer. (One needs to know there the files have been downloaded) Click Next  to proceed.

The Root Directory above is the ‘installation folder’ that hosts the installed/extracted files and by default the path is as shown in the white text input above as C:\OSGeo4W64 . One can change by clicking the Browse… button though we will leave it as is. For the users section, All Users ensures that all users in the computer can access the OSGeo4w software while for the Just Me option only the current user (one who is installing and must have administrative rights) has access to those files. Click Next to proceed.

The Local Package Directory is the folder in which the contents of QGIS Server and other supporting files (not installed files) downloaded from the internet will be saved and the Start menu name is the name that will appear in Windows Startup Programs as shortcut. Just lke the previous one can click on the Browse… button to select a custom location. When Browse… button is clicked, the following Windows Browse window appears as shown below.

Once you select the preferred folder, click OK button to close. Below page shows a custom location that has been selected.

Once the custom location is selected, click Next to proceed.

In the above page, the way with which the setup connects to the internet must be configured. By default the Direct Connection option is selected. Use IE5 Settings uses Internet Explorer 5 connectionconfiguration while the Use HTTP/FTP Proxy option is used where the network is behind a proxy. In this the default option is left as is. Click Next to proceed.

There are various download site URLs that are listed above and the setup downloads from the user selected option. Select one of the links to activate the Next button or one can also add a custom URL in the User URL text field and click Add button. When the existing URL is clicked it appears as shown below.

 

Once the URL has been selected or a custom URL has been input, the Next button is activated and can be clicked to continue.

There are many packages that can be downloaded and installed by the osgeo4W installer and they are listed in the above page. Since the installation is for QGIS Server, click the + sign next wo Web option and it collapses with 5 more options. Click on the Skip option for qgis-server and a version number will appear just as shown above. The rest of the options can be left as is. Click Next button to continue.

The page shown above displays a list of the packages and libraries that will be installed. Click Next button to proceed.

This page initializes a download of the packages from the URL that was selected earlier. Some libraries are shipped with End User License Agreements (EULA) that one must accept to continue as some also have licenses for free, non-commercial usage and et cetera. After accepting these licenses and agreements, click Next to continue.

A page with active progress bars (in green above) appears and the percentage download progress is also displayed at the title bar above. The first progress bar shows the download progress for the individual package being downloaded, the second shows the overall/total download progress of the packages and the third progress bar shown the computer disk size. This process should not be interrupted and it is dependent on internet speed/network latency once complete i.e. at 100% then the following final page is shown. If there are errors in download, then the download failure will be shown in a rather similar fashion. Click Finish button to close the installer wizard. 

 

Next procedure entails installation of XAMPP. XAMPP is a free and open source web application server that is cross-platform and has been developed by Apache Foundation. It consists of Apache Web Server, MariaDB database and Hypertext Preprocessor (PHP) and Perl interpreters among othets. Let’s begin by double clicking the xampp setup that was downloaded in the beginning steps.

The setup wizard appears as shown above. Click Next button to proceed.

Above are the packages that are shipped with the XAMPP setup. For the purposes of QGIS Server, only the Server > Apache is required therefore the rest can be unchecked to match the case above. A breakdown of the main components required for the QGIS Server installation include:

  1. Apache Server – The role of  this server in QGIS Server is to provide Hypertext Transfer Protocol (HTTP) in which the OGC services mentioned in the beginning of this post are dependent on. QGIS Server uses FastCGI protocol that is an Apache module therefore the importance of the server is realized in this.
  2. PHP – This comes tightly coupled with the web server therefore cannot be unchecked (at least for version 8.0.3)

Click Next button to continue.

The page shown the default path/folder in which the selected components of XAMPP will be installed in. By default it installs in the Windows’ system/OS drive i.e. C:\Xampp and to change this click on the icon on the right side of the path field and it opens the file system for one to select their preferred installation location. Once the preferred location is clicked, click Next button to continue.

Select the preferred language and click Next to proceed.

On this page, some info on the developers of the installer, if not interested in the info, uncheck the checkbox as above and by click Next button to continue.

Click Next button to begin installation of the components.

A progress wizard similar to those in osgeo4W installer appears in the middle of the page below the XAMPP welcome image. The installation should not take a lot of time but also depended on hardware specifications. Once the installation is complete, Next button is activated and can be clicked to proceed.

This informs that the installation has completed successfully. Ensure the checkbox in the page is checks so that it can open the XAMPP control panel. Click Next button to proceed.

The control panel assists in enabling and disabling the services listed. In the case above, only Apache has been installed therefore, it is the only active row while the rest are inactive (greyed out). Click on the Start button in the first row for Apache.

The control panel shown above indicates that Apache Server module is running and is assigned the Process Identification (PID) 7036, 150028 and running on port(s) 80, 443. Click on the Admin button.

A browser page is opened with the URL pointing to the localhost and it confirms that apache in deed is running. 

Once both XAMPP and QGIS Server are installed, we have to configure some settings in the default apache configuration file. By default, the apache configuration file (for XAMPP 3.0.8) is located in C:/xampp/apache/conf/httpd.conf

The file shown above can be opened with a text editor like notepad or any other editor that is installed and contains settings/configurations for the apache server and one has to be careful not to remove or insert wrong information in the file as it may affect the working of apache server.

The apache configuration file appears as shown above in Notepad++ text editor.

Let’s confirm hat the file qgis_mapserv.fcgi exists in the bin folder of the qgis app in folder shown above. If it exists then we

Edit the line shown above for the Script Alias (highlighted in grey) to point to the bin directory shown in the previous diagram. Note that the original line has been commented by adding a # before it.

Similarly add a directory directive as shown above (in grey) to point to the same bin folder as the previous and inside it a number of statements that allows apache server permissions to access the folder and also execute the relevant scripts. 

Add an .exe handler in order to enable server to execute the QGIS Server executable files.

Finally, add the following lines as shown above and ensure that the paths in the lines shown above actually exist otherwise there might be errors when attempting to run QGIS Server.

After the above procedures, open XAMPP from the Windows start menu if not running and it will display the control panel and ensure that apache server is already running. Navigate using your browser to http://localhost/cgi-bin/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities which opens a an XML (eXtensible Markup Language) page showing the WMS capabilities of the server.

 

osm_map_in_qgis

QGIS as a WMS, WFS and WCS Client

A Web Map Service (WMS) is a standard leveraged in serving maps that are georeferenced through the web. The WMS standard is maintained by the Open Geospatial Consortium (OGC). The WMS request URL or link consists of a number of request parameters among them includes GetCapabilities and GetMap requests. For more on these refer to the OGC WMS Specification document. WMS output formats include:

  1. Portable Network Graphic (PNG)
  2. Joint Photographic Experts Group (JPEG)
  3. Tag Image File Format (TIFF), GeoTIFF
  4. Scalable Vector Graphics (SVG)
  5. Portable Document Format (PDF)
  6. GeoRSS
  7. Keyhole Markup Language (KML)
  8. KMZ – This is a zipped KML
  9. OpenLayers
  10. UTFGrid

A Web Feature Service (WFS) is a standard for serving Geographic Information commonly referred to as features across the web. Similarly to the previous standard, is maintained by the Open Geospatial Consortium (OGC). The WFS request URL or link consists of a number of request parameters among them includes GetCapabilities, DescribeFeatureType and GetFeature requests among others. For more on these refer to the OGC WFS Specification document. WFS output formats include:

  1. Geography Markup Language (GML)
  2. ESRI Shapefile
  3. JavaScript Object Notation File (JSON / GeoJSON)
  4. Comma Separated Values (CSV)

Where can one download Geospatial Data from?

Geospatial is a term that has been trending for a while now and one that has caught the eye of many with the recent events and trends on space exploration, climate change and digital journalism just to mention a some as this list can be endless. In my own context, this term can be split into two sub-terms;

  • Geo – Relating to earth or ‘has Earth component’.
  • Spatial – Relating to space or ‘has space component’.

For one to analyze data with relation to location then one must get data that has location component and this location has a ‘geo’ and ‘spatial’ component therefore termed geospatial data. There are a gazillion sources of data at a time that we are struggling with handling of big data of all sorts, location-based data being one of them.

I compiled a list of freely available data sources at this time which includes the following:

  • OpenStreetMap This contains crowdsourced and compiled data of regions and the whole world that is updated at various intervals, some daily, weekly, hourly etc. The data consists of way-points, points of interest (POIs), roads and road names and buildings. It also provides an application programming interface (API) through which one can query and download data using other software. For country and other extracts, check here and for the whole world check here.
  • Natural Earth This is a data repository for vector and raster data that is published at different scales and it is supported by North American Cartographic Information Society (NACIS).
  • UNEP Environmental Data Exlporer Data source repository provided by the United Nations Environmental Programme (UNEP) that consist of geospatial datasets related to global and local weather, watershed boundaries, average monthly temperatures etc. To obtain data, one must search either using keywords or the provided filters for searching specific datasets.
  • Copernicus Open Access Hub This access hub provides free access to Sentinel satellite datasets and is managed by the European Commission. One must register and sign in to download data from this repository. The type of datasets to expect from this hub include data related to marine environment, forest cover, wetlands, atmospheric data on solar radiation and pollution among others.
  • USGS Earth Explorer Provides access to earth science data from various satellites such as Landsat through an interactive user interface and is managed by U.S Geological Survey.

There are many geospatial data repositories nowadays and the above list consist of just a small number of them. For more details on geospatial data sources, refer here and here.