[R-sig-Geo] bbox 4-dimensional objects - suitable method?

Edzer Pebesma edzer.pebesma at uni-muenster.de
Mon Nov 23 14:45:16 CET 2009


Torleif,

sp classes SpatialPoints* SpatialPixels* and SpatialGrid* already allow
3- and higher dimensional data; providing an example with nonsense data:

> library(sp)
> data(meuse)
> meuse$z = rnorm(155)
> coordinates(meuse)=~x+y+z
> summary(as(meuse, "SpatialPoints"))
Object of class SpatialPoints
Coordinates:
            min          max
x 178605.000000 1.813900e+05
y 329714.000000 3.336110e+05
z     -2.168683 3.006463e+00
Is projected: NA
proj4string : [NA]
Number of points: 155

It can be used this way to do 3D interpolation (package gstat), and
several of the sp methods work; obviously, several do ignore everything
beyond x and y.

If you store your time as double, you can even think about adding that
as one of the coordinates.

Chapter 6 of http://www.asdar-book.org/ gives code examples of this
approach, where a third dimension represents (posix) time, and methods
are given to select a certain spatial grid from a
SpatialTimeGridDataFrame based on its posix time (range).

The motivation for your approach becomes stronger when time cannot be
stored as double (numeric); I find it harder to see the motivation to
store z differently from the x and y coordinates, create a separate
bounding box for it and rewrite all methods.
--
Edzer


Torleif Markussen Lunde wrote:
> Hi
>
> As previously mentioned I am working on 3D and 4D spatial classes. To get 
> things compatible with the other sp-classes I would like to ask for your 
> opinion what would be the most suitable bbox methods for Spatial3dArrays and 
> Spatial4dArrays.
>
> My first thought was that bbox should return the 2D geographical extent of the 
> object. This to comply with other spatial methods. For the 3D case an 
> additional slot, btime is added to show the temporal extent of the object. As 
> writing the 4D case, I started wondering whether it would be wise to stick to 
> this (my conclusion at the moment is yes). In that case a new slot called 
> zextent could be added.
>
> To retrieve the extent of the different dimensions one would have three 
> functions; bbox(), btime(), and zextent()
>
> The other option is to make a bbox slot as a list. bbox() would still return 
> x-y extent, while bbox.full() could return a list of the full extent:
>
> list(bbox = matrix(c(1,1,4,4), 2,2, 
>      			dimnames = list(c("long", "lat"), 
> 		     	c("min", "max"))),
>     btime = matrix(c("2002-01-01 06:00:00", "2002-01-01 06:00:00"), 1, 2, 
>      			dimnames = list(c("time"), 
> 		     	c("min", "max"))),
>     zextent = matrix(c(512, 1024), 1,2, 
>      			dimnames = list(c("masl"), 
> 		     	c("min", "max"))))
>
> Since bbox is defined as a matrix in Spatial, this would be a bad idea. So, at 
> best bbox could be a matrix of min/max of x, y, and z (since they all are 
> numeric). bbox() would then return a x, y subset of bbox(), while bbox.full() 
> could return a list(xyz, time). 
>
> Any comments on what would be best suitable to be compatible with the other 
> Spatial classes?
>
> Best wishes
> Torleif
> PhD candidate
> Centre for International Health
> Bjerknes Centre for Climate Research
> University of Bergen
> Norway
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de



More information about the R-sig-Geo mailing list