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

yaara.rotman at yahoo.com yaara.rotman at yahoo.com
Tue Jul 19 04:42:29 CEST 2016


 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.

Cheers,Yaara




	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list