You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to use amt in the typical create random points/extract covariates workflow, but I'm running into some problems. I'm not sure if this is the right place to post questions but here goes.
dat <- read_csv('my_data.csv',col_types=cols()) #x,y data for rsf, in lon/lat
rast <- raster('my_layer.tif') #also lon/lat, epsg:4326
The most straightforward approach is to do the following
dat %>%
make_track(lon,lat,crs = CRS('+init=epsg:4326')) %>%
random_points %>%
extract_covariates(rast)
This works but this gives me warning messages (below). I assume because random_points uses sf internally, which doesn't work as well with spherical coordinates.
although coordinates are longitude/latitude, st_intersects assumes that they are planar
Converting to a flat projection then seems to require a fairly convoluted workflow to extract covariates. In addition, the random points object needs to be a spatial object in order to transform coordinates, but using make_track drops the case_ column.
It might be nice if random_points could accept a bounding box (or any polygon) in the coordinates system that matches the tracks, instead of forcing mcp or kde.
Also it might be nice if random points was a spatial object, such as an sf object, so that it's easy to do transformations on the points.
Is there a good way to tell make_track to keep all the columns in the data frame? There might be but I can't figure it out.
Finally, it would be nice if extract_covariates converted to the coordinate system of the raster before doing extraction. This is what raster::extract usually does, and I see in the code that extract_covariates is internally using raster::extract, but if using amt I have to explicitly do the conversion.
Thank you for the help!
Ben
The text was updated successfully, but these errors were encountered:
Hello,
I'm attempting to use amt in the typical create random points/extract covariates workflow, but I'm running into some problems. I'm not sure if this is the right place to post questions but here goes.
The most straightforward approach is to do the following
This works but this gives me warning messages (below). I assume because random_points uses sf internally, which doesn't work as well with spherical coordinates.
Converting to a flat projection then seems to require a fairly convoluted workflow to extract covariates. In addition, the random points object needs to be a spatial object in order to transform coordinates, but using make_track drops the case_ column.
Thank you for the help!
Ben
The text was updated successfully, but these errors were encountered: