Giter VIP home page Giter VIP logo

exactextract_qgis's Introduction

QGIS Zonal ExactExtract

Plugin for QGIS to calculate zonal statistics using exactextract library

Docs โ€ข Demo

Image of the qgis raster menu with zonal exactextract option Image of the plugin window in QGIS

Overview

This is a repository for the QGIS plugin that allows to aggregate/summarize values of the raster over polygonal (vector) areas using exactextract library. This library allows to treat pixel cells as partially covered by polygons using weighting according to the extent of cover. If you want to know more about the library working in the backend of this plugin it's highly recommend to visit its github repository.

"Zonal statistics" tool in QGIS currently have an issues (1, 2) that yield wrong results in certain situations.

Features

  • Multiple supported statistics: Every statistic given by exactextract is supported by plugin (statistics), including array result type (usage of these statistics might slow down calculation and saving stage).
  • Define own, custom functions : Write custom Python code to define how features should be calculated. Custom functions should accept raster values and coverage attributes.

Example: Calculate 90th percentile of raster values:

import numpy as np

def 90th_perc(values, cov):
   return np.percentile(values, 90)

If given statistic is checked in Custom Function combo box there will be new column 90th_perc added.

There is also option to modify custom functions defined by user before. In order to load the code of existing function and modify it the function name should be checked in Custom Function combo box.

Warning: If there's an error during processing of custom function code whole processing will be stopped. Wrong function may also block QGIS or make it crash.

  • Usage of QGIS parallel engine: There is an option to process statistics calculation in multiple parts (subtasks/batch option). Calculation of statistics in this case is done in parallel manner using QgsTaskManager engine. To configure number of parallel cores it will use you should configure Max Threads option in QGIS settings.
  • Support for multiband rasters: In case there's a multiband raster - each band is processed during calculations and is output as separate set of columns.

Features to be added

  • Support for weighting raster;
  • Move all heavy operations to QGIS QgsTask;
  • Ability to output geospatial layer instead of CSV/Parquet only - It might be difficult due to lack of performant way to join GeoDataFrame to QgsVectorLayer;

Input

  • Polygon layer (anything that is read by QGIS)
  • Raster layer (it has to be locally accessible layer. Database raster layers do not work for now)

Output

  • Attribute layer - CSV format is supported by default and Parquet format is supported if fastparquet library is installed.

Current version

It's beta version of the plugin. It is not recommended for production usage yet!

It will be out of beta when:

  • unit and integration tests are added;
  • features are considered completed;
  • documentation is provided with the plugin;

Installation

In current version of the plugin there are 4 packages required:

  • [REQUIRED] Installed through OSGeo4W setup utility (or pip install pandas):
    • pandas
  • [REQUIRED] You may use wheel delivered in this repository (tested with QGIS versions 3.34 and 3.36) or you can compile and install it manually from GitHub repository (exactextract library author is working on uploading it to PyPi) and then pip install wheel (.whl) file:
  • [OPTIONAL] It's advised to install fastparquet (pip install fastparquet) to allow saving results as a parquet file format;

exactextract_qgis's People

Contributors

jakubcha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.