[R-sig-Geo] Issue saving ascii with writeRaster function
Damien GEORGES
damien.georges2 at gmail.com
Fri Jul 25 08:51:05 CEST 2014
Dear all,
When I try to write a raster as .asc file on my HD using writeRaster
function. When I check then the .asc file produce with a text editor,
the first item on my raster is always stored under a strange format (e.g
adding lot of decimals). That cause then some trouble in other software
using this maps as input..
Here a (reproducible example) :
##########
library(raster)
## create raster
r <- raster(ncols=2,nrows=2,xmn=-100,ymn=-100,xmx=100,ymx=100)
r[] <- 1
# plot(r)
## save the raster in acii format
writeRaster(r, filename = "test.asc")
## check .asc file content
cat(readLines("test.asc"), sep="\n")
## output :
# NCOLS 2
# NROWS 2
# XLLCORNER -100
# YLLCORNER -100
# CELLSIZE 100
# NODATA_value -9999
# 1.000000000000000 1
# 1 1
## The first value is 1.00000000000 and I want it to be 1
##########
Does someone has already experiment this kind of issue?
Any suggestion to prevent from it?
Best,
Damien.
More information about the R-sig-Geo
mailing list