<div dir="ltr"><div><div><div><br><br>On Fri, Dec 1, 2017 at 4:26 PM, Vaclav Petras <<a href="mailto:wenzeslaus@gmail.com">wenzeslaus@gmail.com</a>> wrote:<br>><br>> For cropping, see also a new addon module called r.clip which clips according the computational region while respecting mask and the *original* raster resolution:<br>><br>> <a href="https://grass.osgeo.org/grass72/manuals/addons/r.clip.html">https://grass.osgeo.org/grass72/manuals/addons/r.clip.html</a><br>><br>> Testing and feedback welcome.<br></div><div><br></div><div>About <a href="https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.clip/r.clip.py#L42">https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.clip/r.clip.py#L42</a><br></div><div><br></div>g.region align=original<br><br></div>is sufficient. You don't need to specify nsres or ewres when aligning to a raster map because nsres and ewres of the raster map are used anyway for alignment.<br><br></div>Markus M<br><div><div><div>><br>> Vaclav<br>><br>> On Tue, Sep 26, 2017 at 10:35 AM, Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be">mlennert@club.worldonline.be</a>> wrote:<br>>><br>>> On 26/09/17 16:17, Moritz Lennert wrote:<br>>>><br>>>> On 26/09/17 15:57, Marco Alicera wrote:<br>>>>><br>>>>> Dear list,<br>>>>> I am trying to crop a raster map into a smaller area, but I am failing.<br>>>>><br>>>>> This wiki page link <<a href="https://grasswiki.osgeo.org/wiki/Cropping_maps">https://grasswiki.osgeo.org/wiki/Cropping_maps</a>> is<br>>>>> quite clear:<br>>>>> "Make boundary into mask using r.mask<br>>>>> <<a href="https://grass.osgeo.org/grass72/manuals/r.mask.html">https://grass.osgeo.org/grass72/manuals/r.mask.html</a>> then copy raster<br>>>>> source to new map (g.copy<br>>>>> <<a href="https://grass.osgeo.org/grass72/manuals/g.copy.html">https://grass.osgeo.org/grass72/manuals/g.copy.html</a>>). All cells<br>>>>> outside of the mask will be omitted from the new copy."<br>>>>><br>>>>> r.mask vector=myarea<br>>>>> g.copy --overwrite raster=OldRasterWithBigArea,NewRasterWithSmallArea<br>>>>> r.mask -r<br>>>>><br>>>>> I expected all cell outside were not going to be omitted, but replaced<br>>>>> by NULL.<br>>>><br>>>><br>>>> I'm not sure I understand your last sentence, but AFAIK, the wiki info<br>>>> is wrong. g.copy works directly on the files and ignores mask and region<br>>>> settings. In your example, OldRasterWithBigArea and<br>>>> NewRasterWithSmallArea should be strictly identical.<br>>>><br>>>> You need to use r.mapcalc "new = old" while the mask is set to get a<br>>>> raster with everything outside the mask set to NULL.<br>>><br>>><br>>> I've rewritten the wiki page to try to make things clearer.<br>>><br>>><br>>> Moritz<br>>> _______________________________________________<br>>> grass-user mailing list<br>>> <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>><br>><br>><br>> _______________________________________________<br>> grass-user mailing list<br>> <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br><br></div></div></div></div>