Spatial Interpolation with GDAL in Python #2: IDW and Linear Interpolation

  Рет қаралды 13,554

Making Sense Remotely

Making Sense Remotely

Күн бұрын

In this second interpolation tutorial, I talk about the Inverse Distance to a Power and Linear Interpolation algorithms available for the program gdal_grid (or gdal.Grid() if you use the GDAL Python API). I explain a little about the theoretical background of these spatial interpolation algorithms and then apply them to create a regular grid from scattered point data in Python.
gdal_grid documentation: gdal.org/programs/gdal_grid.html
GDAL Grid Tutorial: gdal.org/tutorials/gdal_grid_...
GDAL/OGR Python API: gdal.org/python/
Great playlist on Delaunay triangulation: • Delaunay Triangulation...
Chapters:
0:00 Recap
1:06 Inverse Distance to a Power
10:54 Linear Interpolation
Updated Code:
from osgeo import gdal
from osgeo import ogr
pts = ogr.Open("points.shp", 0)
layer = pts.GetLayer()
for field in layer.schema:
print(field.name)
dem = gdal.Open("dem.tif")
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
pts = layer = None
nearest neighbor interpolation
nn = gdal.Grid("nearest.tif", "points.shp", zfield="elevation",
algorithm = "nearest", outputBounds = [ulx,uly,lrx,lry],
width = xsize, height = ysize)
nn = None
moving average
ma = gdal.Grid("average.tif", "points.shp", zfield="elevation",
algorithm = "average:radius1=500:radius2=800:angle=20",
outputBounds = [ulx,uly,lrx,lry],
width = xsize, height = ysize)
ma = None
inverse distance to a power
idw = gdal.Grid("invdist.tif", "points.shp", zfield = "elevation",
algorithm = "invdist:power=3:radius1=2000:radius2=2000",
outputBounds = [ulx,uly,lrx,lry],
width = xsize, height = ysize)
idw = None
linear interpolation
lin = gdal.Grid("linear.tif", "points.shp", zfield = "elevation",
algorithm = "linear",
outputBounds = [ulx,uly,lrx,lry],
width = xsize, height = ysize)
lin = None

Пікірлер: 18
@user-qy8yq5ff7y
@user-qy8yq5ff7y 5 күн бұрын
Extremely helpful! Please keep updating this series!💕
@dazhouwu9425
@dazhouwu9425 2 жыл бұрын
Thanks for the whole series of gdal in python tutorials! You really make everything clear!
@No0neIsInnocent
@No0neIsInnocent 3 жыл бұрын
Many thanks for all your videos about GDAL, it's highly appreciated. 👍
@Antonio-lp8hx
@Antonio-lp8hx 3 жыл бұрын
highly appreciate your work, especially those awesome 3D animations! (y)
@kmehour
@kmehour 2 жыл бұрын
We need more python/gdal tutorials !!
@duncangraham9600
@duncangraham9600 2 жыл бұрын
This was so good, thank you!
@ernestbayah1640
@ernestbayah1640 3 жыл бұрын
Fantastic. Many thanks for this,
@user-iz5kk4sy6m
@user-iz5kk4sy6m 5 ай бұрын
Perfect explanation, thank you!
@rameshbanagar3946
@rameshbanagar3946 3 жыл бұрын
Wonderful! Thank you for sharing :)
@saberchaghamirza5678
@saberchaghamirza5678 2 жыл бұрын
Its great tanks for sharing
@AJRG1410
@AJRG1410 2 жыл бұрын
That was a great vid! May I ask how did you do the animations? Loved them!
@navneetsrivastava688
@navneetsrivastava688 11 ай бұрын
Please complete the gdal python series. Also it would be very much helpful if you could create a video on how to convert lat long ( spatial coordinates) to pixel coordinates (x,y) and vice versa, with introduction to different projection and crs. Thank you for the video though
@raghwendranarayanshandilya4525
@raghwendranarayanshandilya4525 3 жыл бұрын
Can you please make a video on Kriging interpolation using Python, where X and Y coordinates and Z values are stored in a shapefile? Or if you already have please suggest the link.
@gz6616
@gz6616 4 ай бұрын
Hi, I'm wondering is it possible to provide the 2nd argument to the Grid() function, not using a "points.shp" file name, but some other format? I don't have a points.shp file, but only the x- and y- and z- coordinates. How do I provide those to the Grid() function?
@draufunddran
@draufunddran 3 жыл бұрын
how did you create these 3d animations? i would love to do something similar but actually not animated. Is this donw directly in QGIS?
@makingsenseremotely6207
@makingsenseremotely6207 3 жыл бұрын
Yes, I used the Qgis2threejs plugin for this
@jeewankbastola2272
@jeewankbastola2272 3 күн бұрын
Please provide the files as well so it wont be confusing to practice the same
Spatial Interpolation with GDAL in Python #1: Nearest Neighbor and Moving Average
20:54
Splitting raster data into equal pieces with GDAL in Python
15:40
Making Sense Remotely
Рет қаралды 10 М.
Inside Out Babies (Inside Out Animation)
00:21
FASH
Рет қаралды 23 МЛН
Опасность фирменной зарядки Apple
00:57
SuperCrastan
Рет қаралды 12 МЛН
ВОДА В СОЛО
00:20
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 34 МЛН
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 15 МЛН
Spatial Interpolation Techniques in QGIS
22:12
GeoDelta Labs
Рет қаралды 24 М.
How To Interpolate Data In Python
15:21
Mr. P Solver
Рет қаралды 47 М.
Lesson 14, Part 2: SciPy - 1-D and 2-D interpolation
12:25
Ocean 215: Python Methods for Oceanography
Рет қаралды 5 М.
Ordinary Kriging in Python
11:46
Jeremy Maurer
Рет қаралды 12 М.
Visualizing multi-band satellite images in Python
16:07
Making Sense Remotely
Рет қаралды 12 М.
Spatial Interpolation in GIS
11:48
HydrologyVideos
Рет қаралды 10 М.
Using Folium with GeoPandas
20:18
Geospatial Programming
Рет қаралды 18 М.
regridding and interpolation - an essential life skill !
22:30
Climate Unboxed
Рет қаралды 10 М.
Tutorial: GSTools, a toolbox for geostatistical modeling in Python
2:01:33
Software Underground
Рет қаралды 6 М.
Inside Out Babies (Inside Out Animation)
00:21
FASH
Рет қаралды 23 МЛН