Using the python console in QGis, I would like to interpolate several point files (txt x,y,z) to make rasters.
I have been trying this but it's not working and I don't know enough about python to make it work.
import qgis.core
import qgis.analysis
uri="file:///C:/test.txt?delimiter=,&xField=field_1&yField=field_2&crs=epsg:32755"
layer = QgsVectorLayer(uri, 'test', "delimitedtext")
layer_data = qgis.analysis.QgsInterpolator.LayerData()
layer_data.vectorLayer = layer
layer_data.zCoordInterpolation=False
layer_data.interpolationAttribute =2
layer_data.mInputType = 0
tin_interpolator = QgsTINInterpolator([layer_data])
export_path = "C:/test.asc"
rect = layer.extent()
res = 10
ncol = int( ( rect.xMaximum() - rect.xMinimum() ) / res )
nrows = int( (rect.yMaximum() - rect.yMinimum() ) / res)
output = QgsGridFileWriter(tin_interpolator,export_path,rect,ncol,nrows,res,res)
output.writeFile(True)
I keep getting this error: Traceback (most recent call last): File "", line 1, in File "C:/test.py", line 13, in tin_interpolator = QgsTINInterpolator([layer_data]) NameError: name 'QgsTINInterpolator' is not defined
Can anyone explain what this variable means layer_data.zCoordInterpolation=False, and whether I should put this to True?