Skip to main content

# 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.

74 questions
Filter by
Sorted by
Tagged with
0 votes
1 answer
28 views

### Results of focal statistics in ArcGIS Pro

Based on the instructions on how focal stastics work: https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-analyst/how-focal-statistics-works.htm, I had expeced a more continuous result ...
4 votes
1 answer
917 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 ...
1 vote
1 answer
30 views

### Calculate asymmetric raster-cell neighborhood statistic in R

Statistics for an asymmetric raster-cell neighborhood are required. The application is modelling direct solar insolation over year-long time steps while accounting for local shading effects of ...
0 votes
1 answer
197 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 ...
0 votes
0 answers
16 views

### How do I get a focus pixel function based on a given buffer containing surrounding pixels?

I want to calculate the percentage of built-up pixels surrounding each built-up pixel within a 100 sq.km. I know focal function in R can be of use. But I want to understand the actual algorithm behind ...
1 vote
1 answer
340 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 ...
1 vote
1 answer
57 views

### Assign matrix cell values using variable in Google Earth Engine

I am trying to create a mask for focal analyses in GEE, and need a function that creates an n x n matrix (values = 0). Then I would like to assign values across a "diameter" of the matrix ...
1 vote
1 answer
72 views

### Get results similar to Focal Statistics in ArcGIS at the same speed using Python

I am trying to run focal statistics in Python. The idea is to set a 1 square kilometers buffer (circular) around each pixel, then the percentage of certain type of pixels inside the buffer was ...
6 votes
1 answer
993 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 ...
0 votes
1 answer
76 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 ...
-1 votes
1 answer
77 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 ...
0 votes
2 answers
285 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 ...
0 votes
0 answers
369 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 ...
4 votes
1 answer
1k 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 ...
0 votes
1 answer
58 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
1 answer
177 views

### focalMat weights adjustment

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 <- ...
0 votes
1 answer
119 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 ...
4 votes
3 answers
2k 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
0 answers
164 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....
3 votes
2 answers
158 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 ...
0 votes
1 answer
108 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[[1]], cells=cells_xy, directions=...
0 votes
0 answers
51 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 ...
4 votes
3 answers
3k 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
1 answer
701 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 ...
0 votes
1 answer
423 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 ...
0 votes
1 answer
124 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
0 answers
83 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 = ...
0 votes
1 answer
161 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
0 answers
183 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
4 answers
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
0 answers
94 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 ...
0 votes
2 answers
354 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 ...
0 votes
0 answers
440 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 ...
3 votes
2 answers
377 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 ...
0 votes
0 answers
172 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
1 answer
110 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 ...
2 votes
0 answers
167 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
1 answer
171 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 ...
2 votes
1 answer
189 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 ...
0 votes
2 answers
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 ...
0 votes
0 answers
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 ...
0 votes
1 answer
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
1 answer
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
1 answer
495 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 ...
2 votes
2 answers
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
1 answer
531 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 ...
3 votes
2 answers
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 ...
0 votes
1 answer
2k views

### Determining focal statistics in QGIS?

I'm curious to know what is the counterpart for ArcGIS focal statistics tool in QGIS?
2 votes
1 answer
393 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, ...
4 votes
1 answer
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 ...