Given a matrix of quadrature points and a list of species presences, this function extracts environmental data to presence locations using bilinear interpolation.
1 
sp.xy 
A matrix of species locations containing at least one column representing longitude and one column representing latitude. 
env.grid 
The georeferenced matrix of environmental grids. 
env.scale 
The spatial resolution of the quadrature scheme from which the environmental data is extracted. 
coord 
A vector containing the names of the longitude and latitude coordinates,
as in 
file.name 
An optional argument containing the name of the saved file. Setting

At a given species location with coordinates (x, y), the interpolated value of the
environmental variable z is calculated as a weighted average of z at four reference
quadrature points (x^{(1)}, y^{(1)}), (x^{(1)}, y^{(2)}), (x^{(2)}, y^{(1)}) and (x^{(2)}, y^{(2)})
that form a square of nominated side length env.scale
surrounding (x, y).
A matrix containing locations of species presences in the first two columns and the interpolated environmental data in the remaining columns.
Ian W. Renner
1 2 3  data(BlueMountains)
species.env = env.var(BlueMountains$eucalypt, env.grid = BlueMountains$env, env.scale = 0.5,
file.name = "Sp Env Data")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.