[Qgis-user] Raster Manipulation in the QGIS Python Console

Agustin Lobo alobolistas at gmail.com
Tue Oct 27 04:26:11 PDT 2009


According to
http://www.maths.lancs.ac.uk/~rowlings/Qgis/Plugins/Documentation/rasterlang/python.html
I've done:

 >>> layer1 = iface.mapCanvas().layer(0)
 >>> layer1.name()

but get no answer, I was expecting getting the layer name, as indicated 
in the web page
"This should show the names of your raster layers"

Nevertheles, computing works because I've done:
 >>> from rasterlang.layers import layerAsArray
 >>> a1 = layerAsArray(layer1)
 >>> a1.shape
 >>> rsum = a1 + a1
 >>> from rasterlang.layers import writeGeoTiff
 >>> e = layer1.extent()
 >>> extent = [e.xMinimum(),e.yMinimum(),e.xMaximum(),e.yMaximum()]
 >>> writeGeoTiff(rsum, extent, 
"/media/Transcend/Anyella/calib20090730/rsum.tiff")

and I do get a correct rsum.tiff file that I can display in qgis.

Why am I not getting any answer from the console? a1.shape does not 
return anything either

Thanks!

Agus



More information about the Qgis-user mailing list