On Fri, 19 Sep 2008, milton ruser wrote:

Dear all,
I tryed both suggestions and they worked fine.
In fact, the short solution is

require(rgdal)
require(maptools)
mes01jan<-readGDAL("jan_00")
write.asciigrid(mes01jan,"mes01jan.asc")

One final note: write.asciigrid() in sp has arguments:

args(write.asciigrid)
function (x, fname, attr = 1, na.value = -9999, ...)

while its copy in maptools has:

args(writeAsciiGrid)
function (x, fname, attr = 1, na.value = -9999, dec = options()$OutDec,
    ...)

This accommodates problems that we've seen in ArcGIS' handling of locales differing from users' expectations - by setting dec=, you can impose the understanding of other software.

Roger


Thanks Mike! Thanks Alex!

best wishes,

miltinho astronauta
brazil

On Fri, Sep 19, 2008 at 10:46 PM, Michael Sumner <[EMAIL PROTECTED]>wrote:

I tried this, and AAIGrid is not available for creation by rgdal on my
machine. See gdalDrivers() for those available.

If you install FWTools you can use a workaround to convert the export
externally, e.g.

x <- readGDAL(system.file("external/test.ag", package="sp")[1])

## write to GeoTIFF
writeGDAL(x, "mes01jan.tif",  type = "Byte")

## convert externally to AAIGrid
system("gdal_translate mes01jan.tif mes01jan.asc -of AAIGrid -ot Byte")

## check result
system("gdalinfo mes01jan.asc")

I don't believe that AAIGrid can explicitly support type Byte without
augmentation, so I would carefully check the coercion that occurs (if it's
actually needed).

Cheers, Mike.

milton ruser wrote:

Dear all,
I am reading a set of maps from ArcGRID format using rgdal and I need to
export to ASC format.

But when I try the commands below, I get an error.

require(rgdal)

mes01jan<-readGDAL("jan_00")
image(mes01jan, col=topo.colors(50))  #looks find
writeGDAL(mes01jan, "mes01jan.asc", drivername = "AAIGrid", type="Byte")

Any idea?

miltinho, brazil

       [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
 ------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.169 / Virus Database:
270.7.0/1681 - Release Date: 9/19/2008 3:54 PM






        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to