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. 

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.


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.


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 LANG "en_US.UTF-8"# QGIS log (different from apache logs)
FcgidInitialEnv QGIS_SERVER_LOG_FILE /var/log/qgis/qgisserver.log

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.

Description=X Virtual Frame Buffer Service

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


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.


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.


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.