TransWikia.com

Extract JPEG out of raster based on rectangle location in QGIS

Geographic Information Systems Asked by daky on January 23, 2021

I have 10 overlaying rasters (both one- and multi-band) – same area, different date. I also have shapefile layer with 12 rectangle polygons. enter image description here

What I want is to extract proportion of raster inside each of rectangle and save it as JPEG image. Sure, it’s easy to do it step by step. I select one polygon, clip the raster ten-times for each raster and then move to another polygon. The procedure is clear but please, is there any way how to make it automatically? I mean always select one polygon, extract it 10 times and then select another one – together make 120 pictures ideally in JPEG and save it to folder.

Maybe I could use Graphical Modeler but I’m not sure how to include the condition i+1 for selecting each polygon separately (something like for cycle). Probably it will be necessary to use Python Console but I’m not familiar with scripting in QGIS so far, so I’ll need some hint.

One Answer

If I understand you correctly it is possible that all you need is the iterate over button that is in the clip raster by mask extent algorithm.
iterate over button Just set up the algorithm like you normally would and press the button and instead of using all of the features to cut the raster it will use each feature and return a separate image. It shouldn't take you long to run it 10 times.

Unfortunately I don't think it works with the batch processor and I don't think it is available in the graphical modeler.
A python script would probably be better if you where going to do this often but I don't know python.

Correct answer by Baswein on January 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP