Closed tati-micheletti closed 1 year ago
Problem is happening in maskInputs()
> roadsCropped <- maskInputs(roads , studyArea = studyArea)
maskInputs with sf class objects is still experimental
intersecting ...
Checking for errors in SimpleFeature
Found errors in SimpleFeature. Attempting to correct.
...(Object to retrieve (d211e11599de967e.qs))
loaded memoised result from previous FUN call,
Some or all of the errors fixed.
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 'addAttrToGeom': empty geometries are not supported by sp classes: conversion failed
Failing also on latest CRAN version
# Not working properly either
roadsCropped <- cropInputs(roads, studyArea) # Doesn't fail, but doesn't crop
# But the raster version works
roadsCropped_raster <- raster::crop(roads, studyArea) # works fine
Looks like it is an issue with the roads being lat/long ... I have started a PR with a fix... see if it passes all tests.
As a work around, run it in steps:
preProcess
, then sp::transform
the roads obj, then postProcess
The PR is passing the automated tests, but am running the more strict local tests.
The second problem is incorrect, I believe. I don't think raster::crop
will work on objects with 2 different crs
... However, the cropInputs
doesn't crop indeed.
On Fri, Dec 4, 2020 at 7:42 AM Eliot McIntire notifications@github.com wrote:
The PR is passing the automated tests, but am running the more strict local tests.
The second problem is incorrect, I believe. I don't think raster::crop will work on objects with 2 different crs... However, the cropInputs doesn't crop indeed.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PredictiveEcology/reproducible/issues/182#issuecomment-738854200, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH7S3GNJNJNZEEZBBNSOFADSTD7N5ANCNFSM4UM3IA6A .
No longer relevant
I suspect it is not reprojecting the file before cropping, resulting in an empty geometry, but didn't have time to debug. Works without a problem if
studyArea
is omitted.