|

PyQGIS: Shapefile from Selected Features

A common operation with vector layers is to select features based on attribute values and save those features to a new vector layer (i.e. shapefile). This tutorial will walk you through how to create a new shapefile from selected features. We’ll select some features, then save those features to a new shapefile. First, we’ll open…

|

PyQGIS: Create Raster

In a previous tutorial I showed you how to access raster values and data with the Geospatial Data Abstraction Library (GDAL). This tutorial will show you how to create a raster with GDAL. Start by importing the gdal and osr Python modules. The osr module is used for handling spatial references. Also import numpy. Now…

|

PyQGIS: Loading and symbolizing raster layers

More information can be found in the PyQGIS Developer Cookbook. Requirements QGIS version 3.0, or greater Objectives Load and symbolize a raster layer with pyqgis Get statistics from a raster band Open the QGIS Python Console From the menu, select Plugins -> Python Console, or Ctrl + Alt + P (Windows) You can type directly into…