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

Michael Sumner mdsumner at gmail.com
Tue Jul 19 10:09:53 CEST 2016


On Tue, Jul 19, 2016, 17:30 Yaara via R-sig-Geo <r-sig-geo at r-project.org>
wrote:

> Many thank you for your quick reply,
> Does anyone have a suggestion for a method to calculate the utilization
> density (UD) in this kind of data set?
>
> I used the kernelUD() function in the adehabitatHR package, with smoothig
> parameter= "href", but wonder if this is appropriate in the case of my data.
>



Interpolation like this is really a model and so requires careeful
oversight from you. We don't have enough information to know what's
appropriate for you.

You can apply more general "gridding" to points, start with
raster::rasterize and raster:: interpolate for pointers to general methods,
many provided by other packaged.

Since you have tracking data the methods in adehabitatHR are probably
better than many others. An alternative to give simple time-spent in area
is implemented in the trip package as a rasterize method, but requires
another structure built from the same data. There are many coercion methods
for analogous structures, but these "as(x, 'type')" functions are scattered
around they can take some finding.

Look at different "trajectory" packages and explore what they do in more
detail.

raster() understands adehabitatHR objects so I recommend using that for
more general handling of the gridded outputs.

Cheers, Mike

Thanks,Yaara
>
>
>     On Tuesday, July 19, 2016 1:48 PM, Edzer Pebesma <
> edzer.pebesma at uni-muenster.de> wrote:
>
>
>
>
> 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/
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>         [[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

-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list