[Qgis-user] Same layer extent?

Micha Silver micha at arava.co.il
Thu Oct 25 00:40:49 PDT 2012


On 24/10/2012 22:54, Luciano La Sala wrote:
> Hola!
>
> I am using GRASS inside QGIS and I need to perform some very basic
> arithmetic on raster map layers using "r.mapcalc". Once I have created my
> mapset in GRASS and imported all three rasters into GRASS from QGIS view, I
> define my algorithm by simply doing "Raster_A + Raster_B + Raster_C".
> However, the output gives the message "Unable to open raster map. Finished
> with error".

The r.mapcalc model builder is, in my opinion, tricky to use. Can you 
try your mapcalc expression in the GRASS shell instead, and report back 
what result you get? i.e.

r.mapcalc ABC="Raster_A+Raster_B+RasterC"

> I am not sure what the problema is, but I suspect that it may be related to
> the extent of each layer, which is different for each raster:
>
> Raster_A
> Layer Extent (layer original source projection):
> -264465.6428050000104122,3892490.3601970002055168:
> 1442088.1851800000295043,7588100.0655570002272725
>
> Raster_B
> Layer Extent (layer original source projection):
> -231150.3030560000042897,3942814.9593090000562370:
> 1421853.4221910000778735,7568606.9837530003860593
>
> Raster_C
> Layer Extent (layer original source projection):
> -302992.6578800000133924,3856086.4785620002076030:
> 1162350.0904449999798089,7559207.0393540002405643
>
> Q1: What do these long numbers represent?

These are the upper left and lower right corners of each raster
>
> Q2: Should every raster layer have the exact same layer extent for the
> mathematical calculation to come out right?

No, you can use r.mapcalc on rasters with different extents. However you 
should be aware that wherever any of the maps is NULL, the result will 
be NULL. In other words, for each pixel, if either of your three maps 
has a NULL value, that pixel will become NULL also.
Note that there's also r.patch which was designed to combine maps which 
do not overlap, and fill in NULL values from one map with values from 
the others.

> Thank you so much in advance!
>
> Luciano
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> This mail was received via Mail-SeCure System.
>
>


-- 
Micha Silver
052-3665918




More information about the Qgis-user mailing list