1

I have a raster in GRASS GIS and want to export it as a ASCII file following the ESRI format. This is my code

r.out.ascii --overwrite input=XX@PERMANENT output="...\XX.asc" null_value=-9999

The file generated has the following header

north: 3458710
south: 3454500
east: 353030
west: 348740
rows: 421
cols: 429

while the ESRI one is

NCOLS xxx
NROWS xxx
XLLCORNER xxx
YLLCORNER xxx
CELLSIZE xxx
NODATA_VALUE xxx

My only solution has been to manually edit the header, but i want to export multiple files thus the manual process becomes cumbersome. Does anyone know how to automatically export a raster from GRASS as an ESRI ASCII?

Am using this grass

GRASS version: 7.6.0                                                            
GRASS SVN revision: r73958                                                      
Build date: 2019-01-17                                                          
Build platform: x86_64-w64-mingw32                                              
GDAL: 2.4.0                                                                     
PROJ.4: 5.2.0                                                                   
GEOS: 3.7.0                                                                     
SQLite: 3.26.0                                                                  
Python: 2.7.14                                                                  
wxPython: 2.8.12.1                                                              
Platform: Windows-10-10.0.16299  
1
  • r.out.arc will do it in GRASS before version 7, use r.out.gdal in GRASS 7 or later.
    – Zoltan
    Commented Feb 11, 2019 at 14:28

1 Answer 1

2

What you want is

r.out.gdal input=XX@PERMANENT output="...\XX.asc" format=AAIGrid
1
  • You are a legend. It works perfectly, thanks mate!
    – Juan Ossa
    Commented Feb 11, 2019 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.