[Qgis-developer] Point sampling tool and python console

Xavier Vollenweider x.y.b.vollenweider at googlemail.com
Sun May 20 11:10:13 PDT 2012


Hi all,

I am new to QGIS and to Python.

I would like to use the plugin point sampling tool in order to merge raster
datasets with my observations (a delimited text layer) and then save the
resulting shape file as a csv file. I know how to do it with the GUI:

Add Delimited Text Layer
Add Raster Layer
Point Sampling Tool
Join the layer
Save as .csv

As I have quite a lot of raster dataset to match with my observations (and
I am quite keen to learn Python), I would like to do it with a loop in the
Python console.

Thanks to this post <http://planet.qgis.org/snippets/2/>, I have:

crops="Wheat", "Maize","Barley", "Haricot Bean","Teff"

for i in crops: layer=QgsRasterLayer("C:/Program Files/LEAP/Images/Water
Balance/Meher/2005/"+str(i)+"_Meher_Final_Index_2005.img",str(i));
QgsMapLayerRegistry.instance().addMapLayer(layer)

Any one knows what is the function for Point Sampling Tool, Join the layer
and save in Python?

More generally, how do we use plugins in the python console?

Thanks a lot,

Xav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120520/05869e26/attachment.html


More information about the Qgis-developer mailing list