[GRASS-stats] Scatterplot "thinning" (points reduction)?
Markus Neteler
neteler at osgeo.org
Sun Aug 16 18:44:22 EDT 2009
Hi Dylan,
On Sun, Aug 16, 2009 at 8:02 PM, Dylan
Beaudette<dylan.beaudette at gmail.com> wrote:
> Hi Markus,
>
> Can you sample the original maps with v.random + v.what.rast first?
This gave me the idea: spsample() - I just read page 118 in "Applied
spatial data analysis with R" (great book, http://www.asdar-book.org/ !).
But apparently I am missing something... (I am certainly reading too fast):
# Spearfish example
> mydata <- readRAST6(c("elevation.dem","soils"))
> subdata <- spsample(mydata, 500, type= "random")
Looks good but...
> str(subdata)
Formal class 'SpatialPoints' [package "sp"] with 3 slots
..@ coords : num [1:497, 1:2] 600572 596804 599446 597732 600336 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : NULL
.. .. ..$ : chr [1:2] "x" "y"
..@ bbox : num [1:2, 1:2] 590022 4914167 608953 4927981
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "x" "y"
.. .. ..$ : chr [1:2] "min" "max"
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
.. .. ..@ projargs: chr " +proj=utm +zone=13 +a=6378206.4
+rf=294.9786982 +no_defs
+nadgrids=/home/neteler/grass65/dist.x86_64-unknown-linux-gnu/etc/nad"|
__truncated__
... where are the data?
The original looks like:
> str(mydata)
Formal class 'SpatialGridDataFrame' [package "sp"] with 6 slots
..@ data :'data.frame': 2654802 obs. of 2 variables:
.. ..$ elevation.dem: int [1:2654802] NA NA NA NA NA NA NA NA NA NA ...
.. ..$ soils : int [1:2654802] NA NA NA NA NA NA NA NA NA NA ...
..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots
.. .. ..@ cellcentre.offset: Named num [1:2] 590015 4914025
.. .. .. ..- attr(*, "names")= chr [1:2] "x" "y"
.. .. ..@ cellsize : num [1:2] 10 10
.. .. ..@ cells.dim : int [1:2] 1899 1398
..@ grid.index : int(0)
..@ coords : num [1:2, 1:2] 590015 608995 4914025 4927995
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : NULL
.. .. ..$ : chr [1:2] "x" "y"
..@ bbox : num [1:2, 1:2] 590010 4914020 609000 4928000
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "x" "y"
.. .. ..$ : chr [1:2] "min" "max"
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
.. .. ..@ projargs: chr " +proj=utm +zone=13 +a=6378206.4
+rf=294.9786982 +no_defs
+nadgrids=/home/neteler/grass65/dist.x86_64-unknown-linux-gnu/etc/nad"|
__truncated__
According to
showMethods("spsample")
grids are supported... I guess I am missing a trivial bit, might be
the time here...
thanks
Markus
More information about the grass-stats
mailing list