# Questions tagged [focal-statistics]

Focal Statistics (Spatial Analyst), calculates for each input cell location a statistic of the values within a specified neighbourhood around it.

69 questions
Filter by
Sorted by
Tagged with
43 views

### ArcPy calculating statistic for pixels within specified neighborhood

I'm using ArcGIS Pro and I need to calculate the proportion of pixels within 500m for a specified value. I have a raster with coded values of either 0 or 1. For each pixel, I want to calculate the ...
36 views

### Calculating statistic for pixels within specified neighborhood in R

I have a raster with coded values of either 0 or 1. For each pixel, I want to calculate the percentage of 1s within a 500m radius. Using the focal() function in the terra package seems to be my best ...
1 vote
286 views

### How to supply a weight matrix to focal_hpc in R

I'm using the function focal_hpc from spatial.tools in R to compute for each cell of a raster the average value (mean function) around windows of a specific size (3 cells x 3 cells). I used to perform ...
906 views

### Circular focal means with raster and NAs

I am trying to understand circular focal means using rasters having NA values. I made a couple of scenarios to better understand how to combine weight matrices and functions to summarize values. I am ...
41 views

### Weighted raster using focal statistics and NbrWeight, but instead of using my kernel file, ArcGIS Pro keeps just using the default weights

I can't seem to figure out why ArcGIS Pro won't use the weights I have stored in my kernel file to create the neighborhood for focal statistics. My kernel file is .txt and the variable contains the ...
261 views

### Focal statistics means for very large area of NDVI raster to be used to extract value to points [closed]

I have tried using ArcGIS Pro running on server, NDVI from Living Atlas, and 30,000 points covering the entire eastern half of Colorado to get the mean NDVI mean value around each point for 270 meters ...
215 views

### Spatial Cross Correlation between two rasters

I have two raster data land cover and carbon monoxide, and I wish to perform correlation analysis on the two datasets. I found an article online describing the method using RStudio. I have followed ...
493 views

### R Focal Function - Terra vs Raster

I'm not sure why the focal function I've been using in Raster does not work with Terra. This simplified example uses a custom function to apply the focal filter only to pixels with a value of 0 and ...
38 views

### Getting Focal Stastics to ignore NoData using ArcPy with Multiband Raster

In ArcPy, I am running the Focal Statistics tool to calculate the mean value of a raster within a 20 pixel buffer. I would like to ignore no data so that a value can be calculated even in locations ...
1 vote
100 views

I'm trying to calculate a spatially weighted focal function using terra::focal() and focalMat(). library(terra) r <- rast(ncols=10, nrows=10, ext(0, 10, 0, 10)) values(r) <- 1:ncell(r) w <- ...
91 views

### How to compute edges intensity (edgeness factor) as texture feature

I am trying to extract texture features from an image. I am interested in extracting the Mean and Standard Deviation of the edge intensity (edgeness factor). These texture measures were described by ...
1k views

### How can I get the correct mean from focal() with a circular window?

I am trying to perform focal statistics on a raster in R using a circular window (defined with focalWeight) and the focal function. In my specific case, I want each cell to be the mean of all cell ...
1 vote
121 views

### Creating custom statistic type for use in focal statistics in ArcGIS Pro

I am trying to analyze raster data using a moving window. I am doing this in ArcGIS Pro, but at this point I'm getting stuck on how to use the formula I need as the statistic type of the moving window....
120 views

### Calculate focal statistics from a 10m raster to populate a 1km raster, using the 1km raster to define the window?

I have a binary raster (1-0), cell size = 10m. I would like to generate a 1km raster, where cell values equal the mean value of all cells within a 3 km radius. I know I can use focal statistics to ...
80 views

### How to increase the number of the adjacent cells of a focal cell?

I want to recover the adjacent cells around a focal cell, I could do it by using the function adjacent form the package « raster », cells_adj <- adjacent(Habitat[], cells=cells_xy, directions=...
603 views

### Fill gaps in a categorical image with neighbors values in GEE

I'm reclassifying a DEM asset into 6 categories. However, there are some pixels that don't meet my criteria and are null. I would like to find a way to fill these gaps depending on its area and its ...
40 views

### Finding the minimum value cells orthogonally to a polyline

I have a raster (rast) and polyline (poly) as shown below with the corresponding data. For all the cells that line passes through, I want to find the minimum value among the cells that are located on ...
2k views

### Focal / Moving Window statistics - open source

I am currently running a process that involves the creation of many "Focal Statistics" rasters in ArcGIS. These rasters use varying-radius circular search areas and calculate three different ...
1 vote
514 views

### Filling null areas in raster to match extent of second raster using ArcGIS Pro

I have two global rasters and would like to expand one so that it matches the extent of the second by filling in NoData values with values taken from or averaged from nearby pixels. I have been using ...
307 views

### How to work with raster cell sizes when using Focal Statistics?

I'm trying to calculate the percent area of a certain land cover type within a 5000m window but my results aren't as expected. I've never used focal statistics before but I'm almost certain the ...
105 views

### ArcMap Cell calculations and focal statistics

I have a raster with gridsize 10m x 10m. Cells have values 1 or 2. For every raster cell I want to make a calculation using cells in a 200 cell (2000 m) radius. I want to find out the percentage of ...
1 vote
81 views

### Calculate auto covariant term using focal function from raster package

I want to calculate the auto covariant by myself. At this point I found the function focal from raster package. Here I show I proceeded : glm_BEF_AUTO <- glm(as.formula (MODEL_FORM) ,family = ...
132 views

### Filling no data in raster using focal statistics in batch in ArcMap

I know how to use the below python script to fill no data in a single raster using focal statistics, but I have a series of rasters, I do not want to run the script one by one. Can any people tell me ...
1 vote
140 views

### Defining neighborhood settings in Focal Statistics with Calculate Value using ModelBuilder

I am using ArcGIS Desktop 10.6 with Spatial Analyst. I use ModelBuilder, and I created a model with focal statistic. There are 2 different workflows now. calculate the radius value: This value ...
1 vote
1k views

### Seeking ArcGIS focal statistics alternative in open source Python

I am struggling to do the pixel aggregating of raster in open-source python as similar to the ArcGIS Focal statistics function does, I would like to make a 5 x 5 rectangular window on which the ...
1 vote
79 views

### Focal regression 3x3 group of cells

I have two raster with same resolution and dimension: water-occurrence index and rainfall (mm). I want to create a new raster of SLOPE (a) and INTERCEPT (b) by performing linear regression between ...
300 views

### Is there a way to calculate the geometric mean of a raster in ArcGIS?

For the parameters whose values are log-normally distributed, we should calculate the geometric mean rather than arithmetic mean. In the Focal Statistics, there is option to calculate the arithmetic ...
373 views

### raster::focal fails on a selection of invalid row in R

I try to compute the proportion of 0 in an area of 30km around a given pixel. The raster has a resolution of 100m and it is the map of France. For this, I use the function focal() of the raster ...
356 views

### Using R focal to normalize data

I'm trying to normalize a DEM raster with focal and a function to set values between 0 and 1 (iteratingly from the neighboring cells). Thus, for each cell, a 3x3 matrix is to be created and the ...
136 views

### Writing massive kernel files for focal statistics in ArcGIS Desktop

I would like to run focal statistics on a raster and apply a weighted kernel file. The issue is that I have a dense raster (and I would like to keep it this way for a reason) on the other hand I am ...
1 vote
99 views

### Selecting value of zero from raster and assigning new value based on majority of its neighborhood using ArcGIS Spatial Analyst

I have a raster layer has values +1, -1, and zero. Now I want to select those pixels whose value is zero and assign them new values based on the majority of its neighbor 5*5 cells. Is there anyway ...
145 views

### Seeking global projection suitable for raster preserving equal area

I have a global tif file in epsg:4326 and a shapefile of points distributed around the global. I want to retrieve the sum of the value of pixels around 10km of each point. One obvious thing to do is ...
1 vote
147 views

### Errors when filling/replacing NoData values with Raster Calculator FocalStatistics

I have the following raster, which has many NoData values. Only the NoData values that are in the ocean need to be filled. I made a seperate raster with all the NoData cells that are in the ocean. I ...
155 views

### Focal statistics using GRASS GIS r.mapcalc

I have a workflow in ArcGIS that I'm trying to convert to GRASS GIS. Part of this workflow involves using Raster Calculator to execute a conditional statement. If the conditional statement is true, a ...
2k views

### Applying low pass/median filter over DEM in GeoTIFF format using ArcGIS Desktop?

I want to apply a median/low pass filter (over a few hundred kilometers) over my DEM to reduce the noise. I tried ArcGIS focal statistics tool but no luck. I got a blank GeoTIFF file. How can I do it ...
54 views

### Modification of Line Density using ArcGIS Desktop?

I am using ArcGIS Desktop 10.1. I need to calculate Line Density for polyline vector but the "Search radius" option must be replaced by something like the Neighborhood option in Focal Statistics. I ...
2k views

### How to use sum of circular moving window for each center cell with focal in R

I want to calculate the sum of a moving window circle in R for each center cell. Is there a way to do this in R with focal or focalWeights on my raster (preferrably with map units)? Focal does not ...
1 vote
1k views

### Extracting list of coordinates of all pixels in neighborhood of given pixel in R

I have a Raster layer. I want to get coordinates of all pixels in neighborhood (for example 7*7) of given pixel. Is there any function available to do this in R?
1 vote
458 views

### Vector averaging wind direction using focal buffers in R?

I have a raster of 1 km wind direction data that I need to run a focal buffer on. Instead of using the default buffering mean function, I need to use vector averaging since my wind direction is in ...
3k views

### Calculating Proportion of Land Cover Classes with moving window around point in R?

I am currently using a raster that is a land cover class raster (with 50 different land cover classes at a resolution of 30m). I would like to obtain 50 different rasters (essentially predictors for a ...
1 vote
517 views

### Running a function on subset of a raster image instead of whole image in R

I have a wide swath raster image. I want to detect cloudy pixels based on criteria such that a pixel in raster layer only consider its 25*25 neighborhood not the entire image. My problem is here that ...
1k views

### Why different results of mean calculations with focal in R and Esri ArcGis

I want to calculate the ratio of two different classes in a raster with a circular moving window. My classes are 0 and 1 (I do not want to include the NAs). The radius should be 5 meter. I thought my ...
2k views

### Determining focal statistics in QGIS?

I'm curious to know what is the counterpart for ArcGIS focal statistics tool in QGIS?
352 views

### Calculate focal range on XYZ DEM in QGIS or Spatialite

I have a XYZ DEM of a fairly mountainous terrain and would like to identify flat areas using QGIS. How can calculate focal range in QGIS? Or would there be a way to do this in Spatialite? Ideally, ...
4k views

### Interpolate for no data areas in a raster

I have a raster of the average chlorophyll-a concentration for 1 year (NASA MODIS LEVEL2 1km res). However i am still missing values for the pixels near the coastal zone (really important for our ...
1 vote
297 views

### Condition and focal statisitics on multiple rasters

I'm trying to write a code in Python for several rasters, however I'm wondering if there is a faster way to do this. I'm generating several rasters from a conditional statement for each value in the ...
1 vote
40 views

### Preserving uniqueness for overlapping points when converting from points to raster?

I'm trying to optimize outflow points based on lowest elevation within some tolerance. Using the SnapPourPoint function which does exactly this, but outputs a raster file. I've been converting this ...
1 vote
157 views

### ArcGIS Focal Statistics Returns Out-of-Bounds Result

I am trying to compute a moving window maximum on a raster, such that the output is the max within a 5 mile radius. This should result in an output grid where the maximum is equal to the maximum of ...
1 vote