[GRASS-user] r.out format

Tyler Smith tyler.smith at mail.mcgill.ca
Wed Mar 7 16:26:31 EST 2007


Hi,

I'm having some trouble with r.out.{ascii,gdal}. I need to convert a
number of raster maps to ascii grids. I have done this successfully
with GRASS 6.0.2, using (I think) r.out.ascii. I have just upgraded to
GRASS 6.2.1 (and gdal1.3.2-4), from the Debian repository at 
deb http://debian.gfoss.it/ etch main

Now I'm getting problems. The output from r.out.ascii from GRASS 6.0.2 has
the header:

ncols 5956
nrows 3502
xllcorner -108.976860
yllcorner 24.187389
cellsize 0.008334
NODATA_value -9999

This file was formatted correctly for use with another program (Maxent
by Stephen Philips). When I tried to repeat the export with GRASS
6.2.1 I get a file with the following header:

north: 49:24:18.796644N
south: 25:50:41.471736N
east: 59:33:29.28636W
west: 101:21:56.86362W
rows: 2827
cols: 5017

The difference in rows and cols is correct, as I had altered the
region for this conversion to get a subset of the raster data. I tried
again with r.out.gdal format=AAIGrid, and I got the following:

ncols        5956
nrows        3502
xllcorner    -108.976860000000
yllcorner    24.189671187374
dx           0.008333776360
dy           0.008334428041
NODATA_value      0

This is almost right, and it works in Maxent after I manually remove
the dx and dy lines, and replace them with a cellsize line. However,
the ncols, nrows and corners are wrong - they are from the full raster map, not
the region that I am using. Note that the r.out.gdal command was
issued immediately following the r.out.ascii command, so they should
have the same extent.

What do I need to do to export in the first format above, and to do so
in such a way that only the current region is exported, not the whole
raster map?

-- 
Regards,

Tyler Smith




More information about the grass-user mailing list