Spatial Interpolation with GDAL in Python #1: Nearest Neighbor and Moving Average

preview_player
Показать описание
In this tutorial, I will give an introduction to the spatial interpolation algorithms nearest neighbor and moving average. We will use gdal.Grid() from the geospatial data abstraction library GDAL to create a regular grid from scattered point data in Python.

Chapters:
0:00 Introduction
1:33 Nearest Neighbor
14:14 Moving Average

Code:

from osgeo import gdal
from osgeo import ogr

layer = pts.GetLayer()

gt = dem.GetGeoTransform()

ulx = gt[0]
uly = gt[3]
res = gt[1]

xsize = dem.RasterXSize
ysize = dem.RasterYSize

lrx = ulx + xsize * res
lry = uly - ysize * res

dem = None

# nearest neighbor interpolation
pts = layer = None
algorithm = "nearest", outputBounds = [ulx,uly,lrx,lry],
width = xsize, height = ysize)
nn = None

# moving average
algorithm = "average:radius1=1000:radius2=800:angle=20",
outputBounds = [ulx,uly,lrx,lry],
width = xsize, height = ysize)
ma = None
Рекомендации по теме
Комментарии
Автор

Good to see you back! Thank you for this.

anantharamaniyer
Автор

Thank you very much, everything is clear and helped to apply the algorithm.

ca-scholars
Автор

kindly share us the raster image data you've used to make it easy to follow along with you.
-Thank you in advance

jacobokomo
Автор

5:10 Can you please mention how have you done this step?

柳風-xf
Автор

Thanks a lot, Can you tell me how did you extract the elevations from dem raster file with giving points?

xiaozhenma
visit shbcf.ru