[R-sig-Geo] Can coordinate intervals be not constant in SpatialPixelsDataFrame object??

Edzer Pebesma edzer.pebesma at uni-muenster.de
Mon Jan 27 15:19:23 CET 2014



On 01/27/2014 02:13 PM, Agustin Lobo wrote:
> Still doubts regarding the conversion to SpatialPixelsDataFrame-
> I do:
> load("https://dl.dropboxusercontent.com/u/3180464/delme.rda")
> class(delme)
> delmepx <- SpatialPixelsDataFrame(delme, data=delme at data, tolerance=0.000856898)

SpatialPixelsDataFrame extend SpatialPointsDataFrame and hence contain
the coordinates of each pixel. You need to set the tolerance so it can
approximate the grid layout, which is not regular, but the original
coordinates are not changed. When you would do

fullgrid(delmepx)=TRUE

or alternatively

delmepx = as(delmepx, "SpatialGridDataFrame")

we no longer have pixels, and coordinates are implicit, and later on
derived from the grid layout -- meaning, they've changed.

After this, the error message you see later on vanishes.

Hth,


> delmepol <- as(delmepx,"SpatialPolygonsDataFrame")
> delmepx2 <- SpatialPixelsDataFrame(coordinates(delmepol), delmepol at data)
> suggested tolerance minimum: 0.000635728
> Error in points2grid(points, tolerance, round) :
>   dimension 1 : coordinate intervals are not constant
> 
> I understand that I must set the tolerance value to create delmepx
> because the coordinate intervals
> in delme are not constant. But once I've made delmepx, the intervals
> for the polygon centers of delmepol
> should be constant because have been derived from a
> SpatialPixelsDataFrame object. Yet I get the "coordinate intervals are
> not constant" error.
> 
> This is not big deal in practice (can just keep delmepx), but wish to
> understand.
> 
> Thanks
> 
> Agus
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140127/2b6fe289/attachment.bin>


More information about the R-sig-Geo mailing list