I wanted to call the interpolation plugin for IDW from python plugin and displays its output on QGIS desktop.
I am able to call the function but the output displayed on QGIS qgis desktop with NAN NAN values.
Below are the lines which I have used to generate the output. OS:UBUNTU
import qgis.core import qgis.analysis layer = qgis.utils.iface.activeLayer() layer_data = qgis.analysis.QgsInterpolator.LayerData() layer_data.vectorLayer = layer layer_data.zCoordInterpolation=False layer_data.InterpolationAttribute = 10 #attribute index starting from 0 layer_data.mInputType = 1 tin_interpolator = qgis.analysis.QgsIDWInterpolator([layer_data]) export_path ="/home/usr/Documents/After Krigging/2.asc" rect = layer.extent() output = qgis.analysis.QgsGridFileWriter(tin_interpolator,export_path,rect,300, 300, 1015.33333,728.66667) output.writeFile(True) iface.addRasterLayer(export_path, "interpolation_output")
The image below is the output I got after running the above lines. Can Anyone suggest me what I should do to solve this problem?
It generate the file 1.asc but it have all values as -9999 which is incorrect, can anyone suggest what I need to change in the function call to make sure this kind of data is not generated.