Questions tagged [masking]
Covering or hiding features on a map.
357
questions
39
votes
6
answers
28k
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 ...
14
votes
1
answer
18k
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 ...
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, ...
14
votes
4
answers
32k
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 "...
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 ...
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. ...
11
votes
2
answers
946
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 ...
9
votes
3
answers
12k
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 ...
8
votes
1
answer
986
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 ...
7
votes
5
answers
18k
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 ...
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 ...
7
votes
1
answer
8k
views
How to clip raster inside of circle (python gdal)
I have a source raster and an ERSI shape file, want to crop the raster into the circle.
raster = gdal.Open("raster.tif", gdal.GA_ReadOnly) #read raster
projection=raster.GetProjectionRef()
...
7
votes
2
answers
9k
views
combine raster with another raster mask file - gdal
I have 2 rasters in GeoTiff format. One has all of the land and water and the other is a mask file that shows either 0 for water or 1 for land. I basically want my output to just have the land values ...
6
votes
6
answers
26k
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 ...
6
votes
2
answers
640
views
Replace specific raster class by surrounding classes
I have a classified landcover raster which also contains the classes "clouds" (pixelvalue 5) and "shadows" (pixelvalue 10). I want to eliminate them by replacing these two classes by the majority of ...
6
votes
2
answers
4k
views
Masking layers by a vector polygon layer in QGIS
I have a vector layer of buildings:
and a polygon layer coloured by some quantity:
and I want to mask one by the other to produce this:
This can be done by setting the blend mode to "Multiply" with ...
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
...
6
votes
3
answers
8k
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 ...
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 ...
6
votes
1
answer
10k
views
How to create mask bands in GDAL and Python?
I have small program in Python that uses gdal and numpy to perform a logarithmic scale of some data into the RGB 0-255 range.
Now this input data has a nodata value set to mask the valid values, and ...
6
votes
1
answer
919
views
Writing masked GeoTIFF in rasterio and visualizing in QGIS?
I have an interpolated raster, which is a masked array, that shows where the data is valid. I want to save it as masked TIFF with rasterio.
To test, here's the JSON file, and the code:
import rasterio,...
6
votes
1
answer
618
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- ...
6
votes
0
answers
3k
views
Make a grid map in Leaflet
I want to draw a grid map based on the temperature values in Leaflet.
Similar to the illustration below.
Input data: lat, lon, temperature values, cities' names
Parameters: the dimensions of the ...
5
votes
1
answer
6k
views
Setting masked pixel value in Google Earth Engine image export?
I'm using Earth Engine to preprocess and download some NDVI data. I used a region of interest to clip the imagery to a geometry, and values from the Summary QA layer to mask out pixels that were of ...
5
votes
1
answer
5k
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 ...
5
votes
1
answer
733
views
How to mask everything but a polygon in QGIS?
I am able to draw polygons over areas of interest in QGIS. For example via: Layer -> Create Layer -> New Temporary Scratch Layer, name the layer, select Polygon as Geometry type, OK, select the ...
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('...
5
votes
1
answer
195
views
Cutting Raster using two Polygons as Masks
I am trying to cut this raster in order to drop the outside of the walls white area and the area with the dots.
I made one step using as mask the green polygon but i couldn't remove the inside of the ...
5
votes
1
answer
1k
views
Modifying raster pixel inside polygon using GDAL [closed]
I would like to set to novalue all the pixels of my raster inside a polygon.
I'm trying the gdalwarp command line with -cutline option.
But this command extract the values of my raster inside the ...
5
votes
1
answer
3k
views
layer mask does not mask labels, only vector data
I am using ArcGIS 10. I made a layer mask (polygon) that blocks out everyting in a number of vector layers that is outside the area of interest (outside the boundary of two districts). I successfully ...
5
votes
0
answers
378
views
Google Earth Engine: Prevent Cloud mask algorithm for Landsat-8 from masking coastline
I am trying to remove clouds on Landsat image using cloud mask. However, the cloud mask removes even the shoreline that do not have clouds. I don't know why. Is there another way?
(upper: pre-masked ...
4
votes
3
answers
337
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 ...
4
votes
4
answers
1k
views
How to create a semi-transparent map collar in QGIS composer?
In QGIS 2.14, how can I create a semi-transparent "map collar" (white space around the outside of the page) in Composer?
I imagine the map collar would be some sort of graphic shape (not a feature) ...
4
votes
2
answers
2k
views
Detecting cloud shadows
I am trying to detect cloud shadows in Landsat images.
I came up with producing good shadows and cloud masks. Now I'd like to implement my cloud mask adding cloud shadows.
Do You have a good idea to ...
4
votes
2
answers
4k
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 ...
4
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 ...
4
votes
1
answer
1k
views
Lapply function on raster iterating through SPDF polygons in R
I have a raster DTM and a SPDF. I'd need to mask a different elevation interval of the DTM within each overlaid polygon.
I tried a for loop to iterate through the polygons, but as one might expect ...
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 ...
4
votes
3
answers
136
views
Inverted Polygon in ArcGIS Pro
Back when I used QGIS, I symbolized with the 'Inverted Polygon' setting all the time. Mostly it was to create a half-opaque mask around a feature that I wanted to pop out more prominently, but I can't ...
4
votes
2
answers
4k
views
Extracting raster data to multiple polygons using ArcGIS Desktop?
I have a reclassified raster dataset (10 classes) and I want to find out the area of each class contained within multiple (hundreds-to-thousands) polygons.
I have all the polygons in the same ...
4
votes
2
answers
150
views
Removing overlapping margins on multiple rasters by clipping to polygon grid
I am using ArcMap 10.8
I have multiple digitized historic General Land Office (GLO) maps (JP2 rasters) that I am georeferencing. Each one aligns with a single rectangular feature within an existing ...
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 ...
4
votes
1
answer
826
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 <- ...
4
votes
4
answers
10k
views
How do I create a mask where the masked area can be changed by selection?
I'm working on making a mask in QGIS to have one area(county A) outlined while the other areas(counties) are under a semipermeable layer. I already know how to do this for one selected area.
But my ...
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 ...
4
votes
1
answer
1k
views
Looping mask in ArcPy
I am working with raster data on a worldwide level with a resolution of 30 arc seconds.
I need to export the data into a table format but given the high resolution you cannot run the "Sample"...
4
votes
1
answer
1k
views
Altering elevation of specific cells in raster layer of QGIS?
I'm looking to alter the height of some cells within a raster and it's been suggested that I do this by creating a polygon layer and use that as a mask to alter only the heights of cells within the ...
4
votes
0
answers
230
views
Inconsistently getting "Input shapes do not overlap raster", CRS appear to match
Masking topographic raster data by a shapefile (bedrock geology polygon).
Following this guide I do this:
with fiona.open("geology.shp", "r") as shapefile:
geology_mask = [...
4
votes
0
answers
736
views
Offset after clipping an image using rasterio.mask (illustrated with figures) [closed]
I want to clip an image named img_A of dimensions 14000x10000 using a polygon shape in order to get the same dimensions than another image named img_B of dimensions 1925x1372 (see figure 1 below). The ...
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 ...