How does ST_SnapToGrid work using nearest neighbor interpolation?

المشرف العام

Administrator
طاقم الإدارة
I have rasters in a PostGIS database that are not necessarily aligned (some rasters offset from the grid). I want to use ST_SnapToGrid to align all rasters to the same grid but have some questions about how it works using nearest neighbors.

Which of these ways is how nearest neighbors works?

  1. If the pixels are aligned then it is just the value of the source pixel, but otherwise the target pixel takes on the value of the closest source pixel. This would be akin to "moving" the pixel into the correct place.
  2. The target pixel takes the average of the nearest neighbors, such that it might overlap 99% with source pixel A and 1% with source pixel B but take the averages of these pixels to be the value of the target pixel.
  3. Some other way?

أكثر...
 
أعلى