TransWikia.com

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

Geographic Information Systems Asked by Sabine on May 7, 2021

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 this expression in Raster Calculator in ArcGIS Pro:

Con(IsNull("fill_raster.tif")&"extent_raster.tif"==1, Int(FocalStatistics("fill_raster.tif", NbrCircle(15, "CELL"), "MEAN")), "fill_raster.tif")

This has been working to fill most of the small areas of NoData, but there are still larger or more isolated regions where there are no cells in the "fill_raster" with values, so using the circular neighborhood at a specified size does not reach them. In the image below, I am trying to fill the green areas with data from the grayscale raster, but some of these green areas had no cells with data within the circular neighborhood and remain NoData in the grayscale raster even after applying the focal statistics expression.

Is there a way to specify that the values should come from the nearest cells with data instead of any cells within the specified neighborhood size?

I am trying to fill the green areas with data from the grayscale raster, but some of these green areas had no cells with data within the circular neighborhood and so remain NoData in the grayscale raster even after applying the focal statistics expression.

One Answer

I'll first remove bits of terrain and will try to fill gaps:

enter image description here

enter image description here

Convert your green to integer of 1.

Define cost distance:

Expand_sa("GREEN", "../COST", "1", "1")

Find cells on the border, convert to points:

RasterCalculator_sa('"COST" * "ERASED"', "..BOUNDARY")
RasterToPoint_conversion("BOUNDARY","../boundary_points")

Allocate missing areas to nearest point on the boundary, open it's table and transfer values from boundary points:

CostAllocation_sa("boundary_points", "COST", "../ALLOCATION", "", "", "OBJECTID")
MakeTableView_management("ALLOCATION", "ALLOCATION_View")
JoinField_management("ALLOCATION_View", "Value", "boundary_points", "OBJECTID", fields="grid_code")

Fill missing areas:

Lookup_3d("ALLOCATION", "grid_code", ".../LOOKUP")
RasterCalculator_sa('Con(IsNull("ERASED"),"LOOKUP","ERASED")', "../COMBO")

OUTPUT:

enter image description here

Smooth what I called Lookup before merging with original.

Correct answer by FelixIP on May 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP