raster

Opening and visualizing Fmask in QGIS using a Python Console simple code

Today, I am going to present a gist that I developed that separates the masking information contained in a Fmask layer into different bands, to be visualized separately, in QGIS, using the Python Console of QGIS, also known as PyQGIS.

How to use GDAL to save raster files in Python

Solutions using rasterio work, we all know that. However, installing rasterio and GDAL in the same conda environment is many times a challenge… So I usually try not to install both of them together. I am showing to you today what I think is, in my experience, the easiest way to save raster data using GDAL.

How to use a Virtual Layer instead of mosaicking rasters on QGIS

Today, I am presenting an alternative to raster mosaicking. It's all about the creation of a virtual raster. The main reason is that a virtual raster file uses much less hard disk space than a raster mosaic. If my rasters are 80KB then that is not a problem, but what if my rasters are each 1GB?

How to read grib2 raster data on Python

I use pygrib to open the files. In their documentation, they point to two ways to install pygrib, using pip or using conda. However, I could only make it work using conda. Run this in your Anaconda Prompt to install pygrib.

Solved: new version rasterio 1.0+ won’t let me use GDAL transforms

This week, I am discussing an error which used to be a warning on the old rasterio - and I ignored it. Lesson learned! I was doing my usual savings of GeoTIFF rasters in an updated python environment (with rasterio 1.2.6) when I saw this error:

Using SAGA Raster Calculator on QGIS - a quick tutorial

The SAGA Raster calculator is useful because it allows to make some calculations that the regular QGIS Raster Calculator does not. Especially, it allows us to use the X and Y coordinates of the raster as inputs for our calculations. How do we start?

Solved: GDAL accuses no free disk space when there is plenty

[SOLVED] ERROR 3: Free disk space available is 85802630536 bytes, whereas 730874237760027488 are at least necessary. You can disable this check by defining the CHECK_DISK_FREE_SPACE configuration option to FALSE.

When I mosaic two rasters, the size of the resulting raster is almost always larger than the sum of the sizes of the original rasters. Why is that?

Short answer: your GIS software needs to fill the blanks in the area with NoData pixels. Long answer: I will demonstrate what happens by an example on QGIS 3.18, and show why the final raster tends to be larger than the other two summed.

How to georeference images using QGIS 3

Today, I am going to show you how to georeference an image using QGIS 3.18. Maybe you found this image in a paper, or maybe it is an aerial photograph. It doesn’t matter! If you know the coordinates of at least two non collinear points, you can add geolocation to the image!

How and when to use QGIS 3 tools “Warp (reproject)”, “Clip raster by extent” and “Clip raster by mask layer”

Today, I am discussing different ways of cutting (clipping) a raster in QGIS and what they do. Especially, I am comparing QGIS GDAL tools “Clip raster by mask layer”, “Clip raster by extent” and “Warp (reproject)” in what are they used for, and what exactly do they do to the original raster data.