New Virtual Raster Data Provider for Raster Calculator in QGIS

QGIS and Tasks
QGIS is a powerful Free and Open Source GIS software, you can work with everything that has some spatial characteristics. The aim of this project is to add some tool to the existing raster calculator to facilitate some workflows.

Project proposal
The proposal for GSoC 2021 that I submitted can be found here.

Abstract
QGIS already has an integrated raster calculator, where user can enter an expression that will apply raster algebra functions to one or more input rasters and produce a new raster file. This project aim is to develop a new virtual raster data provider that can help to use the raster calculator without creating a lot of files on a disk. It will be possible to perform the computation on the fly when map gets rendered. It will be therefore possible for the users to see the results of raster algebra expression that has been typed without the creation of derived raster files. For example, it should be possible to compute the NDVI index on-the-fly.

Link to Github repository: Repository

17th May - 6th June
Community bonding period:

Taks

17th May - 30th May 1st June - 6th June Plans for next week:
 * Get in contact with mentors, try to code something and look for some small bugfix I can work on;
 * Join Slack channel created by mentors and plan the weekly meeting as they suggested;
 * Set up of the development environment for QGIS (build the code from source, fork the official Repository and create a new branch, set Qt creator environment as it's described in the documentation for the developers );
 * Start to dive into the code base by studying the existing QgsRasterDataProvider;
 * Introduce myself over the channel and shared my proposal on the mailing list for suggestions and feedbacks;
 * Create a wiki page for the project and my User page;
 * Sumbit a PR for simple bugfix to the official repository;
 * Update of the proposal and share the updates with the community;
 * Study the codebase, start to study and implement some simple unit test;
 * Prototype the new virtual raster data provider with some basic methods, add the new provider to the provider registry class, start to write some unit test in c++, study the raster calculator class: I've done several commit on the forked repository so everyone can see what I am doing: it's possible to find the new provider and the test I added.
 * Have a meeting and confront with mentors;
 * Work and add methods to the prototyped class I've created;
 * Add some methods to the unit test I wrote accordingly to the new provider class;
 * Study the raster calculator classes.

First Week: 7th June - 13th June
Coding Period:

Taks [1] https://github.com/Franc-Brs/QGIS/pull/3
 * Update with mentors: I received advices and some help;
 * Move the provider I created from QGIS/src/core/providers/ to QGIS/src/providers/;
 * I write a CMakeLists.txt to include the class I created and to target the libraries I will use in my class;
 * Add, under mentors advice, a function to add the provider to the provider registry dynamically;
 * Study the raster calculator and add some functionalities of the raster calculator to the new provider;
 * Work on the test part, study the other existing tests and adding minor changes to the my test class;
 * create a PR to my personal main repo from the branch in which I'm committing the changes, in this way it will be easier to check the changes and add comments or advices [1];

Plans for next week:
 * Add some methods to the test class;
 * Refining the prototyped class and add some checks in the methods I added;
 * Have the meetings with mentors.

Second Week: 14th June - 20th June
Coding Period:

Taks
 * Update with mentors about some technical issues of my code;
 * Add a method to the test class in order to call the virtualrasterprovider class I created;
 * Update the CMakeList.txt in order to target all the required libraries in the test;
 * Develop the raster calculator functionalities in my provider in the block method, using some hardcoded data;
 * Debug my code to check where it fails in returning the raster block with the hardcoded data;

Plans for next week:
 * Adjust the code to return the correct computed data from the block method;
 * Start to look at and design the methods for taking the uri with all the parameters;

Third Week: 21th June - 27th June
Coding Period:

Taks
 * Refine the block method in order to compute some easy map algebra with hardcoded data and an hardcoded expression;
 * Add some specific function in the unit test in order to inspect the values of the computed raster of the code;
 * Study of the existing parsing and decoding method for the URI and study QUrl in particular;
 * Pseudocode the methods for the parse and decode of the URI;

Plans for next week:
 * Develop the methods in some class of qgis_core to parse and to encode the uri that will be given to my provider (that was moved from qgis_core to providers);
 * Refine the methods of the prototyped provider in order to add some check on the parameters given by the uri;

Fourth Week: 28th June - 4th July
Coding Period:

Taks
 * Define a syntax for the uri that will be passed to my provider with all the information that it needs (extent of the block, width, height, output crs, formula defined in the calculator and raster entries that will be used in the formula)
 * Add encode and decode methods to qgsRasterDataProvider class, so that they are available in qgis core;
 * Add the above methods to my virtual raster provider in order to deal with the given uri;
 * Add a method in the unit test class of virtual raster provider to test the decode method;

Plans for next week:
 * Refine the encode method accordinggly to the defined syntax for the uri;
 * Add some test method to verify that my code works in the correct way for the encode part;

Student's Biography
I am Francesco Bursi and I’m currently enrolled at Advanced Master on "GIScience and Unmanned System for the integrated management of the territory and the natural resources - with majors" with specialization in GISCIENCE and GEOINFORMATICS (Level 8 EQF) at the University of Padua, in Italy. I took my master’s degree in civil engineering attending the Polytechnic of Turin in 2017. I'm passionate about informatics and GIS, and I really love OS environment. Some more information about me can be found on Linkedln and on Github

Mentors
Martin Dobias

Peter Petrik