[R-sig-Geo] storing data frame as SpatialPixelsDataFrame with coordinate intervals not constant

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Jul 19 07:47:49 CEST 2016



On 19/07/16 04:42, Yaara via R-sig-Geo wrote:
>  Hi All,
> I am trying to store my bird tracking data (data frame,  wfg), which contains the following, to a SpatialPixelsDataFrame class, in order to estimate the utilization distribution using BRB function in the adehabitatHR package.
> head(wfg)  bird             Date      lon      lat
>  BYH003 2015-03-03 16:01 116.3377 29.17813
>  BYH003 2015-02-24 17:00 116.5762 29.15807
>  BYH003  2015-02-15 9:01 116.5378 29.15275
>  BYH003  2015-03-26 2:00 116.1493 29.69087
>  BYH003 2015-04-07 18:00 123.2714 42.80138
>  BYH003  2015-02-28 2:00 116.5735 29.15929
> 
> I am first storing in a SpatialPointsDataFrame.
> 
>> wfgP <- SpatialPointsDataFrame(wfg [, c("lon", "lat")], wfg)
> ## I then want to store it into SpatialPixelsDataFrame
>     SpatialPixelsDataFrame(wfgP[c("lon", "lat")], wfgP, tolerance = sqrt(.Machine$double.eps))
> result in the error:Error in points2grid(points, tolerance, round) : 
>   dimension 1 : coordinate intervals are not constant I read that because my coordinates intervals are not constant, I should set the tolerance intervals. But this still doesn't allow the storing of SpatialPixels.
> I tried different tolerance values, but still couldn't solve it.
> Can I actually store this data set in SpatialPixelsDataFrame? If someone can point out on my mistake, I will highly appreciate.


SpatialPixelsDataFrame are there for data whose spatial coordinates
coincide with a location on a regular grid. Typical tracking data
results in locations that are completely irregular. tolerance tries to
find the grid if data are nearly on a grid. In your case, they are not
nearly on a grid.

Hth,

> 
> Cheers,Yaara
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> 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; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/
Spatial Statistics Society http://www.spatialstatistics.info

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


More information about the R-sig-Geo mailing list