Questions tagged [masking]

Covering or hiding features on a map.

Filter by
Sorted by
Tagged with
6 votes
6 answers
27k views

Deleting polygon defined area from raster layer in ArcGIS Desktop?

Which tool do I use in ArcGIS 10.1 for Desktop to exclude areas covered by vector polygon layers from a raster layer? I want to keep portions of the raster layers that exclude the portions covered ...
nancy's user avatar
  • 61
15 votes
4 answers
34k views

Clipping raster layer with *raster* mask layer in QGIS

Given two input layers The clip layer - an arbitrary layer (though in my case it's a float 1 band geotiff) The mask layer - a paletted raster in which every pixel is either NO DATA or a single "...
Llaves's user avatar
  • 5,963
14 votes
4 answers
14k views

Using polygons to apply unique value to all raster cells within those polygons?

In ArcGIS 9.3, I have a raster file that I would like to "mask" with polygons, giving a single value to all the raster cells that overlap the polygons. How can I do this? Here's a screen shot, ...
Luke's user avatar
  • 397
39 votes
6 answers
29k views

Increasing speed of crop, mask, & extract raster by many polygons in R?

I'm extracting the area and percent cover of different land use types from a raster based on several thousand polygon boundaries. I've found that the extract function works much faster if I iterate ...
Luke Macaulay's user avatar
11 votes
1 answer
11k views

R raster: masking a raster by polygon also remove cells partially covered?

I want to mask out a raster based on the values of a polygon: i.e., set to NA all values of the raster that are not covered by the polygons. However, it seems that raster::mask() masks out cells (i.e. ...
Matifou's user avatar
  • 2,011
7 votes
3 answers
9k views

Changing raster cell values within polygon using QGIS GUI

How do I change the values of raster cells which are within a polygon, leaving all cell values outside the polygon unchanged? I would like to subtract 1.5m from each raster cell value within the ...
ffinnm's user avatar
  • 448
5 votes
1 answer
3k views

Masking pixels inside the polygons using Google Earth Engine?

I am working on a classification problem on agricultural fields. To make things easier, I first identified road, cities, water, fields, and etc. I am planning to eliminate road, cities, and water out ...
Batuhan Kavlak's user avatar
2 votes
1 answer
2k views

Masking GeoTIFF file after GeoJSON through rasterio - "Input shapes do not overlap raster"

So my intention is quite simple: I have a 4-Band TIFF file I want to crop after a polygon shape. However, I'm getting the following two exceptions WindowError: windows do not intersect ValueError: ...
Buruiană Cătălin's user avatar
0 votes
1 answer
3k views

Clipping Rasters with a mask layer error

I've got a NDVI layer that I'm trying to clip with a vector file but when I try and use GDAL Tools clipper I get an error. That shows up like this: What am I doing wrong? This is before I even pick ...
Dean Walker's user avatar
12 votes
3 answers
2k views

Considering holes/constraints in Voronoi polygon creation in QGIS?

I am trying to create voronoi polygons in QGIS that would consider "holes" in the general domain. An example would be: I actually created the Voronois in this image using QGIS through the GRASS ...
LeaningCactus's user avatar
9 votes
3 answers
13k views

Turning shapefile into mask and calculating mean

I have been using Python to process huge arrays stored as NetCDF files. I would like to calculate the mean of an area defined by a shapefile. I have just installed GDAL but if there are other tools I ...
questions's user avatar
  • 107
8 votes
3 answers
19k views

Remove NA from Raster Layer

I have a RasterLayer and a SpatialPolygonDataFrame. I used the mask function to create a new RasterLayer. The output is correct but it does include lot's of NA values. Now I want to get rid of ...
obrob's user avatar
  • 857
6 votes
1 answer
8k views

rasterio masking with GeoJSON from file issue

I'm trying to load GeoJSON from a file for use with rasterio mask on a GeoTIFF and I can't seem to get the GeoJSON to load properly. I get this error: File "/Users/user/example.py", line 18, in clip ...
beaorn's user avatar
  • 295
4 votes
1 answer
2k views

How to ‘invert’ or ‘reverse’ a vector cutline when gdalwarp'ing a raster?

I have a raster of North America and I'd like to remove the larger lakes from it, replacing them with the same no-data value as the original raster. So I downloaded Natural Earth's 10 meter lakes ...
Ahmed Fasih's user avatar
3 votes
2 answers
8k views

Sentinel Cloud-free Collection Google Earth Engine Code Editor

I am trying to create and map an image collection (not image or mosaic if that is even possible), where QA60 defines the Cloud-mask. I have written the code below - however, it seems the Jan2016 ...
Caroline's user avatar
1 vote
1 answer
1k views

Extrapolating with IDW (Feature Classes) in ArcGIS Pro?

I have been struggling to extrapolate beyond the extent of the point features input into the IDW tool of ArcGIS Pro. I believe IDW interpolation is the method for me, i just need the process to ...
UnsoughtNine's user avatar
0 votes
1 answer
2k views

Cloud mask using pixel_qa

I need to create a cloud mask using the pixel_qa band, this is the code that I have so far: var city = ee.Geometry.Point(9.15, 45.18); var landsat8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') // ...
Alberto Curti's user avatar
15 votes
1 answer
19k views

Is Clip (Data management) or Extract By Mask (Spatial Analyst) more efficient?

I'm trying to clip down an Orthophoto to a county boundary. I've been using the Extract By Mask Tool, but this process has been running for about 12 hours! It's gone through 2 cycles already, so I'm ...
user26133's user avatar
  • 451
12 votes
2 answers
991 views

Styling specific layer by using polygon mask in QGIS?

I have a line layer and a polygon layer in QGIS: I would like to style the part of the line layer outside the polygon using one style and the part inside using a different style: I don't want to ...
Chau's user avatar
  • 4,480
8 votes
1 answer
1k views

Reduce extent of raster processing in ArcPy or ArcGIS Desktop?

I need to reduce the processing extent of my raster by some sort of automatic procedure in python. Currently the borders of the dataset I've been using has anomalies (due to the classification of the ...
GeoPy's user avatar
  • 593
7 votes
2 answers
2k views

Counting number of unmasked pixels per image in collection using Google Earth Engine

I'm trying to count the number of pixels that are masked by the cloud mask of the image collection given by the Earth Engine dataset. I have clipped my collection with a ROI and now I want to keep the ...
laurent's user avatar
  • 81
6 votes
1 answer
632 views

Stacking and masking Landsat at the same time with rasterio

Based on answers from previous questions 1,2 and the Masking a raster using a shapefile guide from rasterio cookbook, I wrote the code below. The code runs correctly. I would like to improve it. 1- ...
mlateb's user avatar
  • 139
6 votes
1 answer
6k views

Creating a mask with transparent pixels in Python

I have a GeoTIFF image with pixel intensities ranging between certain values. Let's say between -2 and 2 (the image is normalized). I have a certain threshold which interests me, let's sat 1. I would ...
JEquihua's user avatar
  • 1,087
5 votes
1 answer
6k views

How to reclassify raster inside polygon mask, leaving values outside as they are?

I am in the final stages of a landcover classification and need to reclassify thematic raster values that are inside different polygon masks, while leaving the values outside as they are. Can I do ...
Simon's user avatar
  • 51
5 votes
1 answer
2k views

How to apply a Cloud Mask in a collection?

I am trying to apply a mask cloud in a SAVI collection (LANDSAT) to get a chart with time variations between pixels. var region = table3 Map.addLayer(table3) var col = ee.ImageCollection('...
Juan TB's user avatar
  • 393
4 votes
1 answer
875 views

Associating country to grid cell in R?

I’m trying to solve the following problem. I have a regular grid of points covering Europe nx <- 361 ; ny <- 181 xmin <- -30.0 ; ymin <- 25.0 dx <- 0.25 ; dy <- 0.25 lat <- ...
efz's user avatar
  • 143
4 votes
2 answers
10k views

Determine if point is within an irregular polygon using Python

I would like to create a mask of a grid where points are evaluated as either 1's or 0's depending on if they lay outside of an irregular (i.e. not rectangular) polygon. I have a set of high-latitude ...
ryanjdillon's user avatar
4 votes
1 answer
2k views

Creating water and vegetation mask via image collection?

I am a Java script and EE novice but I'm already a great fan of Google Earth Engine. I am simply trying to create a single NDVI and NDWI masked layer to work on. Below you'll find my Frankenstein of a ...
Richie's user avatar
  • 43
4 votes
2 answers
7k views

Creating polygon mask in QGIS

In QGIS 3.22.5, is there possible to use polygons for the masking layer? I want to use numerous little polygons to mask lines (only layer which consists of lines). In ArcGIS that works just by ...
mlr6's user avatar
  • 41
4 votes
3 answers
612 views

Use Raster Layer as a Mask over a polygon in QGIS

I have a raster layer, as seen on the attached image, that works as a background of my working area. The red line, that marks the limit between the two countries, is a .shp file that, naturally, goes ...
Trikelians's user avatar
3 votes
1 answer
524 views

Create a polygon to match non-white (or non-empty) part of a raster

I have a irregular raster with empty spaces as seen in the attached image, which is the southwest corner of my raster. I would like to create a polygon or a mask that matches the non-white regions of ...
TCR's user avatar
  • 117
3 votes
2 answers
3k views

Calculating water occurrence of Sentinel-1 images in Google Earth Engine

I would like to derive the occurrence of surface water bodies from Sentinel-1 image collection in the Google Earth Engine.In my example I could already compute the water mask using Otsu’s method for ...
Stephan Büttig's user avatar
3 votes
1 answer
858 views

Add a nodata mask or alpha band to read-only image?

How to add a nodata mask or alpha channel to a source image that is read-only or should be treated as such? For example I have this satellite image that uses jpeg compression in a geotiff. Since the ...
matt wilkie's user avatar
  • 28.2k
3 votes
1 answer
4k views

Apply cloud mask to sentinel 2 image in SNAP

I want to apply one of the cloud masks in the sentinel 2 file to the sentinel image. The sentinel 2 image I have downloaded features files concerning cirrus and opaque clouds at 10m, 20m and 60m. ...
Will.S89's user avatar
  • 339
3 votes
0 answers
503 views

Expanding raster within mask by interpolating it with boundaries set to 0

I'm having a hard time trying to expand a raster within a mask. Here are some details about my case: I'm working with glacier ice thickness rasters, which happen to be smaller than the real size of ...
Jordi's user avatar
  • 31
3 votes
1 answer
2k views

Preserve attribute table while using Extract by Mask in ArcGIS

When using the Extract by Mask function on a raster with several columns (beyond value and count) in the attribute table, the resulting raster does not have all the columns (it only has value and ...
user1186's user avatar
  • 111
3 votes
1 answer
285 views

Create a band mask based on pixel locations, not in pixel values

I have this image loaded in QGIS, with two possible values for the pixels: 1 = orange, 2 = blue For simplification, assume it represents a province of a country. I want to extract just the part of ...
Jorge Arévalo's user avatar
3 votes
3 answers
4k views

How to crop an image based on a shapefile using GeoTools

I'm writing a web application using GeoTools (it's Java running in a web container). I need to crop a raster file based on a shape file. The core GeoTools documentation and examples I can follow ...
msr's user avatar
  • 161
3 votes
1 answer
3k views

How to invert polygons (or other options for exterior styling)?

I have a shapefile containing many polygons that I want to use to mask a raster. I have tried gdalwarp -cutline <shapefile> -crop_to_cutline -srcnodata -9999 -dstnodata -9999 <source_raster&...
Gregory's user avatar
  • 1,661
3 votes
1 answer
1k views

Masking/removing polygons from shapefile

I have a shapefile containing the road traffic noise of a city. The shapefile has 5 columns, where 'noise_in' (noise interval) ranging from 1-5 is included. I want to remove/mask the road noise from ...
Kasper's user avatar
  • 307
2 votes
2 answers
6k views

Rasterio error: Input shapes do not overlap raster but reprojection not working

I'm trying to use rasterio (v1.0.13) and fiona to perform a raster clip on a geotiff using a geojson polygon. For reference, the clip works perfectly from the command line using GDAL: gdalwarp -...
metalaureate's user avatar
2 votes
1 answer
582 views

How I get the masking area data and export data in Google Earth Engine?

Here is my code in GEE: var CO = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CO') .filterDate('2018-07-04', '2018-07-05') .select("CO_column_number_density"); var CO_merged = CO....
Xun's user avatar
  • 21
2 votes
1 answer
756 views

Cropping raster file with GDAL warp C++ API

I need to crop a DEM raster file with a shapefile. This shapefile has many polygons. I need to calculate several variables after the crop operation. The algorithm is written in C++ so I want to call ...
Chang's user avatar
  • 300
2 votes
1 answer
2k views

Mask out pixels smaller than 1ha in Google Earth Engine

I am new here so please forgive any mistakes in this post: I have a simple script to classify cultivated area vs none cultivated areas using Sentinel-2 in GEE. I want to mask out all objects that are ...
Sibonile's user avatar
2 votes
3 answers
9k views

Masking with rasterio in Python

Introduction I have a shapefile for my area of interest (which in this case is Tehran) and also a TIF file that contains the categorical information(cloud status). In this case, I want to mask the TIF ...
TheFaultInOurStars's user avatar
2 votes
1 answer
612 views

How to use Turf mask when Polygon has islands in inner rings/inner rings

I am getting some weird result with turf.mask(). This is the polygon I am trying to run the mask() function with: https://gist.githubusercontent.com/Stophface/50155878441205412001247878f58b63/raw/...
four-eyes's user avatar
  • 3,378
2 votes
1 answer
579 views

Can't clip vector layer from a raster layer I created

I've been trying to clip an area in a raster image which I have created from an OSM. However when I fill out the raster clipping form I get the following message. Error 1: Output dataset. tif exists, ...
JLangemeijer's user avatar
1 vote
1 answer
824 views

Using MOD11A1 bitmask to select "Good Data Quality" pixels for further LST time series generation in Google Earth Engine

I'm trying to generate a daily LST time series over a region by selecting only the good quality pixels. The code I've written is attached below along with the dataset description. My aim is to select ...
Vineeth's user avatar
  • 47
1 vote
1 answer
2k views

Mask Sentinel-2 image using SCL product in Google Earth Engine

I need to create a Google Earth Engine (JavaScript API) function to mask the pixels corresponding to no_data, satured_or_defective, dark_area_pixels, cloud_shadows, unclassified, ...
sermomon's user avatar
  • 964
1 vote
1 answer
1k views

Restricting Tin interpolation in QGIS

I am trying to do a bathymetric map for a lake using QGIS. However, I see no option to impose a mask so interpolation does not extending beyond the boundaries of my lake. I have traced around the ...
user21979's user avatar