Clip a Raster with a Polygon in QGIS (Extract by Mask)

  Рет қаралды 99,063

Geospatial School

Geospatial School

Күн бұрын

This tutorial demonstrates how to use QGIS to clip a raster layer to the shape of a polygon. This operation is also referred to as clip by mask, or extract by mask. QGIS makes clipping a layer to polygon very simple. If you're having trouble with no data values being displayed as zero or in black, this tutorial will show you how to fix it.
Website: opensourceopti...
Sign up for email notifications (opensourceopti...) and get $5 off any course at opensourceopti...

Пікірлер: 68
@sam_ua
@sam_ua 8 ай бұрын
thanks a lot! made a dozen steps in order to achieve the result needed, but then discovered this feature with no data value - exceptionally thanks to your example! all the best
@geospatialschool
@geospatialschool 8 ай бұрын
Glad it helped!
@krishnendupolley6100
@krishnendupolley6100 3 жыл бұрын
Thanks for the tutorial, but my clipped layer appears with a black rectangle around it, how can I get rid of it? I think you have explained it at the last part of your tutorial, but if you can explain it in a bit detail, it will be helpful for me.
@Pipi108
@Pipi108 3 ай бұрын
3 years later and its still helping out people like me! Thank you for taking your time to make this video
@hsahil_10
@hsahil_10 3 ай бұрын
Thank you for the nice explanation. I had difficulty with that black area around my clipped raster.
@guodingchen3350
@guodingchen3350 3 жыл бұрын
interesting shape!
@pitruchhaya
@pitruchhaya 3 жыл бұрын
Thanks, much needed. I tried this in Q 3.10.4 and it showed the exact output as Extract by Mask in ArcMap. Also, when I exported it to ASCII using the Translate tool, there was no need to set the NoData values and kept it as default, and it worked.
@geospatialschool
@geospatialschool 3 жыл бұрын
Nice work!
@morimori313
@morimori313 2 жыл бұрын
Omg thank you. I didnt know that I need to assign a no data value. I've been so frustrated with that black border.
@geospatialschool
@geospatialschool Жыл бұрын
You're welcome!
@jacknguyen5063
@jacknguyen5063 Жыл бұрын
Thanks for clearly explanation! it is so helpful to me
@sittietidong2094
@sittietidong2094 Жыл бұрын
Why you did not include how you put the polygon and what is the purpose
@anuragverma-by8ww
@anuragverma-by8ww 2 ай бұрын
THANK YOU!!!
@blissmelody1873
@blissmelody1873 Ай бұрын
My qgis is not showing extractions option in raster. What to do for that
@saeidshamsaliei2536
@saeidshamsaliei2536 3 жыл бұрын
Thank you very much. very helpful
@geospatialschool
@geospatialschool 3 жыл бұрын
Glad it was helpful!
@youhasful
@youhasful Жыл бұрын
really great, works nicely. Thanks!
@geospatialschool
@geospatialschool Жыл бұрын
You're welcome!
@kikilriki
@kikilriki 2 жыл бұрын
i get "ERROR 1: Cannot compute bounding box of cutline. Cannot find source SRS" and don't knwo what to do, nothing works!
@keithbjohnson1
@keithbjohnson1 2 жыл бұрын
I had the same error message. I entered the "Source CRS" value... even though it displays the CRS for the input layer, I copied that into the Source CRS field, and the clipping extraction worked. In my case this meant entering EPSG:4326, becuase that was the CRS of the input raster.
@rathaiahyv3469
@rathaiahyv3469 2 жыл бұрын
very nice explanation. thanks
@geospatialschool
@geospatialschool 2 жыл бұрын
You are welcome
@benhall2680
@benhall2680 2 жыл бұрын
Nice tutorial! What if I want to reverse the clip, that is, only keep that part of the raster that is outside of the polygon?
@colbygeary2313
@colbygeary2313 2 жыл бұрын
You ever find a solution?
@kopicaptupai
@kopicaptupai 2 жыл бұрын
me too im looking for this kind solution
@VHenrik007
@VHenrik007 2 жыл бұрын
Same, is there a way to do that?
@RobertThomson
@RobertThomson 2 жыл бұрын
Bump...I'm keen to know if this is possible too.
@VHenrik007
@VHenrik007 2 жыл бұрын
@@RobertThomson So I found a way in the end, however it's not exactly what I hoped it'd be. You have to create another shape layer, which covers the whole original raster. And then you have to subtract the mask from that huge shape layer, making a third one. This was the only option I found.
@kerwinkencunanan35
@kerwinkencunanan35 6 ай бұрын
HELP The Following Layers Were Not Correctly Generated always pops up!
@godwin.k
@godwin.k Жыл бұрын
Indredible ! I'm now find a solution! Thanks ! I have another question. After doing a clip action , I have a very bad resolution for my output. I try everything , but I still have it
@geospatialschool
@geospatialschool Жыл бұрын
You should be able to adjust the resolution when running the tool.
@godwin.k
@godwin.k Жыл бұрын
@@geospatialschool Thanks for your response but how to do it ?
@JulienSavidge
@JulienSavidge Жыл бұрын
Hello, I am trying to the exact opposite of this. Basically I would want to cut that shape out the raster and keep the rectangular raster and leave the polygone blank. What is the best way to do this?
@geospatialschool
@geospatialschool Жыл бұрын
You'll do it the exactly the same. You just need to make a polygon for the area you want to keep. To do that you might need to create a larger polygon, then difference it from the area you want to remove.
@alexgabriel5650
@alexgabriel5650 2 жыл бұрын
Thank you very much!
@geospatialschool
@geospatialschool 2 жыл бұрын
You're welcome!
@joshuah.9687
@joshuah.9687 2 жыл бұрын
Following this, I get the correct clipped raster, but the resolution has drastically dropped. I tried checking "Keep resolution of input raster", but nothing changed. Resolution still dropped.
@joshuah.9687
@joshuah.9687 2 жыл бұрын
Checking the pixel size on both layers, the original states: 9.25,-9.25, but the clipped raster also has the same pixel #, but what is on screen is a lot different...
@veeranjaneyulukale2602
@veeranjaneyulukale2602 3 жыл бұрын
Why does the clipped raster doesn't match with the polygon when zoom in to pixel level?
@rashmiyadav987
@rashmiyadav987 3 жыл бұрын
Did u got any solution for this problem sir? I am facing the same issue...
@Inscissorr
@Inscissorr 3 жыл бұрын
@@rashmiyadav987 it might just be a rendering issue, have you tried setting the color gradient values as the original layer?
@karensalisbury2289
@karensalisbury2289 3 жыл бұрын
On some clips, the colouration alters, I have one with thick red lines on the raster. when I do a clip the result is with very thin, dashed lines. Is there a setting I need?
@geospatialschool
@geospatialschool 3 жыл бұрын
It sounds like after the clip your raster may be overlapping a vector layer? Rasters are not going to be displayed as lines.
@karensalisbury2289
@karensalisbury2289 3 жыл бұрын
@@geospatialschool the original image has clear thick red bourndary in the image but the clip is "washed out" I was hoping to paste an image of both, but cant see an option
@dreamquarter
@dreamquarter 3 жыл бұрын
Why is it ok to clip using input layers with different CRS?
@geospatialschool
@geospatialschool 3 жыл бұрын
QGIS will reproject layers so they match. Sometimes this can cause problems. If results aren't turning out correctly it is often because of different CRS
@dreamquarter
@dreamquarter 3 жыл бұрын
@@geospatialschool Ok. I'm working on a project where I use rasters with different CRS. Before I clip them with a country-vector, I use the Warp tool to have them all in WGS 84.
@25924637
@25924637 2 жыл бұрын
Can I use this method to clip an area from the Google Satelite base map?
@geospatialschool
@geospatialschool 2 жыл бұрын
Nope. You can't clip basemaps
@25924637
@25924637 2 жыл бұрын
@@geospatialschool Thanks.
@Chicojls
@Chicojls 2 жыл бұрын
hey, so my main raster has unique value symbology, and a bunch of named classes and colors i chose by hand. Is it possible to clip the main raster and keep the information like symbology and so on? Because i clipped and it changed the colors and the values to default.
@Chicojls
@Chicojls 2 жыл бұрын
Nevermind, figured it out. I notice we can save a color map file and that did the job. Thanks anyway
@priyankapriyadarshinisahoo7582
@priyankapriyadarshinisahoo7582 7 ай бұрын
How do I save the masked portion so as to use it as a DEM for other new projects?? PLEASE HELP!!!!!!!
@geospatialschool
@geospatialschool 7 ай бұрын
Select the option to save to a file then enter the file name to save it.
@행복한준희의하루-d8o
@행복한준희의하루-d8o 2 жыл бұрын
Can't you name the file with polygon name?
@breeneco
@breeneco 7 ай бұрын
Thankyou!! This stuff isnt intuitive
@geospatialschool
@geospatialschool 7 ай бұрын
You're welcome!
@locrogin
@locrogin 3 жыл бұрын
Thanks very much for showing me how to do this!
@geospatialschool
@geospatialschool 3 жыл бұрын
No problem!
@seaterrai8735
@seaterrai8735 Жыл бұрын
Cutline polygon is invalid why???
@mbtnc
@mbtnc 2 жыл бұрын
Hello, What is the difference between a "normal" view and a materialized view? Why can a materialized view make more sense with raster data?
@42Pursuit
@42Pursuit 2 жыл бұрын
Exactly what I was looking for. Thanks!
@geospatialschool
@geospatialschool 2 жыл бұрын
Glad I could help!
@bukumun
@bukumun Жыл бұрын
thanks, very helpful
@geospatialschool
@geospatialschool Жыл бұрын
You're welcome!
@alialsakkaf4799
@alialsakkaf4799 10 ай бұрын
that is great ! many thanks
@geospatialschool
@geospatialschool 10 ай бұрын
You are welcome!
Clip a Raster Layer in QGIS (three different ways)
6:17
Geospatial School
Рет қаралды 60 М.
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 6 МЛН
Calculate NDVI from Sentinel 2 and reclassify in QGIS
10:07
Hans van der Kwast
Рет қаралды 37 М.
Clipping Raster (DEM) by a Polygon in QGIS
5:13
GIS Training
Рет қаралды 58 М.
Get OpenStreetMap layers and batch clip to your area in QGIS
14:38
Extracting Raster Values using Points, Polygons & Lines | QGIS
17:46
QGIS User 0036 - QGIS and Blender
34:07
Klas Karlsson
Рет қаралды 101 М.
QGIS Contours and Contour Labels
14:21
Geospatial School
Рет қаралды 184 М.
Clip Raster data (.TIF) with a Polygon (shapefile) in QGIS
6:35
Spatial Data Hub
Рет қаралды 9 М.
Developing a 3D Model using QGIS
13:19
GeoDelta Labs
Рет қаралды 140 М.
Merge Raster Layers in QGIS (Create a Raster Mosaic)
5:04
Geospatial School
Рет қаралды 60 М.
Cropping Raster using a Shapefile in QGIS | Clipping Raster
5:14
Researchocrat
Рет қаралды 5 М.