[GRASS-user] clip and rotate a raster

Surely a stupid question, but I can’t find a way to clip a raster on the base of the region settings and/or the base of a vector. I can MASK, I can reclass, but I can’t clip!
Furthermore, is it possible to rotate a raster without the use of a 1st polynomial rectification through GCPs?

Giovanni

Hi,

if you already have a raster that fits your region then simply create a
MASK and just create a new raster with r.mapcalc.

r.mapcalc clipped_rast=rast

(r.mapcalc works only on the MASK so you can quickly clip any raster
like that).

On Fri, 2008-01-25 at 00:15 +0100, G. Allegri wrote:

Surely a stupid question, but I can't find a way to clip a raster on
the base of the region settings and/or the base of a vector. I can
MASK, I can reclass, but I can't clip!
Furthermore, is it possible to rotate a raster without the use of a
1st polynomial rectification through GCPs?

Giovanni
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences, Albert-Ludwigs-University Freiburg
.
Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 / Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany

I don’t have a raster that fits my region. I should create a vector with v.in.region, rasterize it and use it as a MASK… well, I hoped there was something more linear. The same could be used to clip on the base of a polygon.

The unsolved problem is rotation (and shift): making affine tranformations using just a x-shift and y-shift parameter, and a rotation angle having set a point as origin (or just around the “center” of the raster).

2008/1/25, Nikos Alexandris <nikos.alexandris@felis.uni-freiburg.de>:

Hi,

if you already have a raster that fits your region then simply create a
MASK and just create a new raster with r.mapcalc.

r.mapcalc clipped_rast=rast

(r.mapcalc works only on the MASK so you can quickly clip any raster
like that).

On Fri, 2008-01-25 at 00:15 +0100, G. Allegri wrote:

Surely a stupid question, but I can’t find a way to clip a raster on
the base of the region settings and/or the base of a vector. I can
MASK, I can reclass, but I can’t clip!
Furthermore, is it possible to rotate a raster without the use of a
1st polynomial rectification through GCPs?

Giovanni


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences, Albert-Ludwigs-University Freiburg
.
Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 / Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany

Although I don't know how (!) I read in a post about i.rectify... Why
don't you dig-up the man page...

Cheers,

Nikos.

On Fri, 2008-01-25 at 00:53 +0100, G. Allegri wrote:

I don't have a raster that fits my region. I should create a vector
with v.in.region, rasterize it and use it as a MASK... well, I hoped
there was something more linear. The same could be used to clip on the
base of a polygon.

The unsolved problem is rotation (and shift): making affine
tranformations using just a x-shift and y-shift parameter, and a
rotation angle having set a point as origin (or just around the
"center" of the raster).

2008/1/25, Nikos Alexandris <nikos.alexandris@felis.uni-freiburg.de>:
        Hi,
        
        if you already have a raster that fits your region then simply
        create a
        MASK and just create a new raster with r.mapcalc.
        
        r.mapcalc clipped_rast=rast
        
        (r.mapcalc works only on the MASK so you can quickly clip any
        raster
        like that).
        
        On Fri, 2008-01-25 at 00:15 +0100, G. Allegri wrote:
        > Surely a stupid question, but I can't find a way to clip a
        raster on
        > the base of the region settings and/or the base of a vector.
        I can
        > MASK, I can reclass, but I can't clip!
        > Furthermore, is it possible to rotate a raster without the
        use of a
        > 1st polynomial rectification through GCPs?
        >
        > Giovanni
        > _______________________________________________
        > grass-user mailing list
        > grass-user@lists.osgeo.org
        > http://lists.osgeo.org/mailman/listinfo/grass-user
        --
        Nikos Alexandris
        .
        Department of Remote Sensing & Landscape Information Systems
        Faculty of Forestry & Environmental Sciences,
        Albert-Ludwigs-University Freiburg
        .
        Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 /
        Skype: Nikos.Alexandris
        .
        Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany
        

--
Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences, Albert-Ludwigs-University Freiburg
.
Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 / Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany

Nikos, I ask because I’ve read almost all the pages of the manual. I use i.rectify: it is the tool to rectify rasters on the base of GCPs. This is not the case.

2008/1/25, Nikos Alexandris < nikos.alexandris@felis.uni-freiburg.de>:

Although I don’t know how (!) I read in a post about i.rectify… Why
don’t you dig-up the man page…

Cheers,

Nikos.

On Fri, 2008-01-25 at 00:53 +0100, G. Allegri wrote:

I don’t have a raster that fits my region. I should create a vector
with v.in.region, rasterize it and use it as a MASK… well, I hoped
there was something more linear. The same could be used to clip on the
base of a polygon.

The unsolved problem is rotation (and shift): making affine
tranformations using just a x-shift and y-shift parameter, and a
rotation angle having set a point as origin (or just around the
“center” of the raster).

2008/1/25, Nikos Alexandris < nikos.alexandris@felis.uni-freiburg.de>:
Hi,

if you already have a raster that fits your region then simply
create a
MASK and just create a new raster with r.mapcalc.

r.mapcalc clipped_rast=rast

(r.mapcalc works only on the MASK so you can quickly clip any
raster
like that).

On Fri, 2008-01-25 at 00:15 +0100, G. Allegri wrote:

Surely a stupid question, but I can’t find a way to clip a
raster on
the base of the region settings and/or the base of a vector.
I can
MASK, I can reclass, but I can’t clip!
Furthermore, is it possible to rotate a raster without the
use of a
1st polynomial rectification through GCPs?

Giovanni


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences,
Albert-Ludwigs-University Freiburg
.
Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 /
Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany


Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences, Albert-Ludwigs-University Freiburg
.
Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 / Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany

G. Allegri wrote:

I don't have a raster that fits my region.

this will do it:
r.mapcalc 'regionrast = 1'

The unsolved problem is rotation (and shift): making affine
tranformations using just a x-shift and y-shift parameter, and a
rotation angle having set a point as origin (or just around the
"center" of the raster).

some ideas.

simple translation without rotation: r.region

90 deg rotation / flipping:
r.out.mat -> Matlab or GNU Octave.
ML>> array_rot = orig_array' ;
% flip array left-right or up-down
ML>> array_flip = fliplr( flipud( orig_array ) ) ;
r.in.mat

for rotation by angle you could do more complicated stuff in Matlab.

In GRASS i.rectify may be an option.

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

Hi Hamish, thanks for the hints. I’ve already tried using r.region, but it seemed to me it just managed boundaries. How could it be used to shift xy?

2008/1/25, Hamish < hamish_b@yahoo.com>:

G. Allegri wrote:

I don’t have a raster that fits my region.

this will do it:
r.mapcalc ‘regionrast = 1’

The unsolved problem is rotation (and shift): making affine
tranformations using just a x-shift and y-shift parameter, and a
rotation angle having set a point as origin (or just around the
“center” of the raster).

some ideas.

simple translation without rotation: r.region

90 deg rotation / flipping:
r.out.mat → Matlab or GNU Octave.
ML>> array_rot = orig_array’ ;
% flip array left-right or up-down
ML>> array_flip = fliplr( flipud( orig_array ) ) ;
r.in.mat

for rotation by angle you could do more complicated stuff in Matlab.

In GRASS i.rectify may be an option.

Hamish


Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

G. Allegri wrote:

Surely a stupid question, but I can't find a way to clip a raster on the
base of the region settings and/or the base of a vector. I can MASK, I can
reclass, but I can't clip!

r.resample will resample a map according to the current region
settings.

To clip to a vector map, convert the vector area(s) to a raster then
use it as a mask.

Furthermore, is it possible to rotate a raster without the use of a 1st
polynomial rectification through GCPs?

No.

You can translate and/or scale a map by changing its boundaries with
r.region, but the only tool to rotate or skew a map is i.rectify
(there isn't an r.rectify).

--
Glynn Clements <glynn@gclements.plus.com>