Forcing raster snapping to use bilinear interpolation

1824
11
Jump to solution
12-19-2018 02:16 AM
sebastianotrevisani
New Contributor II

From what I understand when there are two or more rasters not aligned (i.e., a small shift of their pixel centers) the snapping in arcgis is generally performed via nearest neighbor. In some circumstances this is not a good solution, it is better to align pixels using bilinear interpolation (or other interpolation approaches). So I'm wondering if the alignment/snapping by means of bilinear interpolation in arcgis can be forced in this way: by means of the "resampling" tool, setting the same original pixel size and as resampling techinque the bilinear interpolation, with the care of selecting in the environments setting  the snap to the raster to which we need to be aligned. 

0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

You can't use another resample method on the fly. You must use the Resample or Aggregate tools on your data beforehand to use anything but nearest neighbor resampling. 

The bilinear and cubic techniques can be applied using the Resample tool as a pre-processing step before combining rasters of different resolutions.

Cell size and resampling in analysis—ArcGIS Help | ArcGIS Desktop 

View solution in original post

0 Kudos
11 Replies
DanPatterson_Retired
MVP Emeritus

It is a good idea to check your raster environments when using tools from arctoolbox

Raster analysis settings—ArcGIS Pro | ArcGIS Desktop 

sebastianotrevisani
New Contributor II

Thank you Dan!

However I'm using Arcmap 10.5.1, and in the "environment settings" of the toolboxes I see the option you mention in "Raster Storage" settings, where the parameter "Resample" is reported. Are you referring to this, right?

Probably remembering this option in the help a the voice "How the Snap Raster environment setting works" could be very helpful. 

Thank you for your quick feedback.

Sebastiano

curtvprice
MVP Esteemed Contributor

You can't use another resample method on the fly. You must use the Resample or Aggregate tools on your data beforehand to use anything but nearest neighbor resampling. 

The bilinear and cubic techniques can be applied using the Resample tool as a pre-processing step before combining rasters of different resolutions.

Cell size and resampling in analysis—ArcGIS Help | ArcGIS Desktop 

0 Kudos
sebastianotrevisani
New Contributor II

Well, from what I have seen, the first reply of Dan is correct. You can set in the "environmental settings" of the toolboxes, in the section "raster storage setting", to use bilinear interpolation when there are misalignment issues. So this setting should work on top of every tool whenever some misalignment is present. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

You should change the correct answer in case people don't see your final comment

0 Kudos
SteveLynch
Esri Regular Contributor

Sebastiano

Curtis Price is correct.

You need to open the help for the tool in question and scroll down to the Environments section. It'll list all the environments for that tool. All the tools in Spatial Analyst's Surface toolset, however, do bilinear interpolation by default because these tools deal primarily with floating point data.

-Steve

DanPatterson_Retired
MVP Emeritus

Actually, you should check both Environments, the general raster environments as in my link, and each tool's environments.  The latter I 'assumed', but I guess people haven't been bit enough by that omission.

  • read each tool's help
  • check general environments
  • check tool environments
  • check file input and output paths for KISS compliance
SteveLynch
Esri Regular Contributor

Dan Patterson‌ well said 🙂

0 Kudos
sebastianotrevisani
New Contributor II

Dear all,

Thank you for your replies.

Some preambles:

1) generally my rasters are already aligned (e.g., outputs from simulations that are inherently aligned or aligned with other software, such raster package in R, or the nice Gdal library). So I had to take care of this only by chance because I got some rasters from other colleagues.

2) I'm used to read help of tools that I'm using. 

Having said that, I'm using focal statistics and raster calculator (arcgis 10.5.1, not Arcgis Pro, as reported by Dan) and for both, in the help, what I see as environment parameter that could be related to misalignment issues is "snap raster".  But to be honest I don't see (also in the related "snap raster"- help) mention of nearest neighbor, bilinear or cubic interpolation.

I see these options only in raster storage settings (in the environments of arctoolbox).

----------------------------------------------------------------------------------------------

"Raster Calculator (Spatial Analyst)

Environments

--------------------------------------------------------------------------------------------------

Now, if you say that the reply of Curtis is right (i.e., "you can't use another resample method on the fly. You must use the Resample or Aggregate tools on your data beforehand to use anything but nearest neighbor resampling.), this mean that my initial hypothesis  (i.e., "I'm wondering if the alignment/snapping by means of bilinear interpolation in arcgis can be forced in this way: by means of the "resampling" tool, setting the same original pixel size and as resampling techinque the bilinear interpolation, with the care of selecting in the environments setting  the snap to the raster to which we need to be aligned) was right. Or not? 

 

Thank you,

Sebastiano

 

0 Kudos