How to Interpolate Over 2 Million Points Quickly and Without Freezing - Tutorial
/Interpolating large volumes of spatial data through the QGIS graphical interface is often a headache: the process takes too long or, even worse, the program freezes while consuming all system resources. In this tutorial, we will show you how to interpolate nearly 2 million points in less than two minutes using the OSGeo4W Shell and GDAL commands with the IDW method. By creating a virtual layer file (.vrt), you will learn a highly efficient, reliable, and lightweight workflow that enables you to work with millions of data points without being constrained by the limits of the GUI.
Tutorial
Code
For the virtual layer:
<OGRVRTDataSource>
<OGRVRTLayer name="points">
<SrcDataSource relativeToVRT="1">CSV:2022-08-19-UTM-25cm.xyz</SrcDataSource>
<SrcLayer>2022-08-19-UTM-25cm</SrcLayer>
<OpenOptions>
<OOI key="SEPARATOR">TAB</OOI>
<OOI key="HEADERS">NO</OOI>
</OpenOptions>
<GeometryType>wkbPoint</GeometryType>
<GeometryField encoding="PointFromColumns" x="field_1" y="field_2" z="field_3"/>
</OGRVRTLayer>
</OGRVRTDataSource>
GDAL command:
gdal_grid -a invdistnn:power=2.0:max_points=12:radius=20:nodata=-9999 -txe 697086.0 697829.0 -tye 4345594.0 4346001.0 -tr 1.0 1.0 -zfield "field_3" -of GTiff --config GDAL_NUM_THREADS ALL_CPUS points.vrt output_1m_grid.tif
Input data
Download the data from this link.
