[R-sig-Geo] readAsciiGrid (maptools)

Roger Bivand Roger.Bivand at nhh.no
Tue Nov 13 14:35:44 CET 2007


On Tue, 13 Nov 2007, Ingo Holz wrote:

> Hi,
>
> I have an ESRI-Ascii-Grid file which looks like this:
>
> ncols 1001
> nrows 1001
> xllcorner 3539000
> yllcorner 5379000
> cellsize 1
> NODATA_value -9999
> 766,65 766,65 766,67 766,69 766,7 766,72 766,74 766,76 766,78 766,8
> 766,83
>
> I imported this file as.image with readAsciiGrid():
>
> kachel1 <- readAsciiGrid(file1, as.image=T, dec=",")

OK. We'll retire the as.image argument, please import it directly and 
coerce to image afterwards, and compare with the import using readGDAL in 
rgdal. Using the example data on my platform the problem is not 
reproducible. Can you make a copy of the data file available compressed on 
a website?

>
> After that I get the following "summary results":
>
> min(kachel1$x)
>  [1] 3539001               #  I think this should be 3539000

Rounding up for printing from the cell centre (3539000.5) on your 
platform - what is the value with more digits?


>
> kachel1$x[1:10]
> [1] 3539001 3539002 3539003 3539004 3539005 3539006 3539007
> 3539008 3539009 3539010
>
> This are 1001 different values in kachel1$x !

A list for image has x, y, and z members, where the x and y are the 
sequences of cell centres for each axis, and z is a (length(x)) by 
(length(y)) matrix.

Roger

>
> And...
>
> is(kachel1$x)
> [1] "numeric" "vector"
>
> However:
>
> summary(kachel1$x)
>   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> 3539000 3539000 3540000 3540000 3540000 3540000
>
> Why this?
> Ingo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at 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: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list