Comments (5)
This change in "raster" fixes that. I still need to see if that breaks some other package. You can also work around it by assuring that the raster data have a crs. And since the next version of landscapemetrics won't use raster anymore, the problem should also disappear for that reason alone.
from raster.
I cannot reproduce this. Can you make sure you are using the current version of R and the "landscapemetrics" and "terra" packages? Both print messages when you load them, but you do not show them (you should include them when showing your code), like this:
library(landscapemetrics)
#Starting from v2.0.0, landscapemetrics does not support the 'raster' or 'sp' packages.
# They are replaced by 'terra' and 'sf', respectively. More information
# about the 'terra' package can be found here: https://rspatial.org/index.html.
library(terra)
#terra 1.7.32
Also, what is your operating system? What is your version of GDAL?
gdal()
#[1] "3.6.2"
from raster.
I am running R on Windows 11.
> library(landscapemetrics)
Starting from v2.0.0, landscapemetrics does not support the 'raster' or 'sp' packages.
They are replaced by 'terra' and 'sf', respectively. More information
about the 'terra' package can be found here: https://rspatial.org/index.html.
> library(terra)
terra 1.7.29
> gdal()
[1] "3.6.2"
I have located the problem. The following code could reproduce the problem in R console:
library(landscapemetrics)
library(terra)
# The following line cause the problem. Maybe I should report it to landscapemetrics package.
options_landscapemetrics(to_disk = TRUE)
r <- rast(landscape)
z <- spatialize_lsm(r, what = c("lsm_p_area", "lsm_p_circle"))
zz <- rast(lapply(z$layer_1, rast))
plot(zz)
writeRaster(zz, filename = "lsm.tif", overwrite = TRUE)
from raster.
The problem is that when set options_landscapemetrics(to_disk = TRUE)
, landscapemetrics write the layer z$layer_1$lsm_p_area
to a temp file with extension .grd/.gri, and rast does not recognize it. That seems a format recognized by raster
package.
from raster.
Thanks a lot. I have installed the latest version of raster
from github. It fixes the problem.
from raster.
Related Issues (20)
- Strange errors when running raster_3.6-20 with terra_1.6-41 HOT 1
- Reading of txt files for raster gives error: "Error in .rasterObjectFromFile(x, band Cannot create a RasterLayer object from this file." HOT 4
- no slot of name "file" for this object of class "RasterStack" HOT 2
- Error in locating/segmenting trees from vegetation subset and existing " unreadable" CHM with "no matching extents" (NA values) HOT 1
- Error in reading shapefiles HOT 1
- Distance function will run infinitely when provided NaN instead of NA's HOT 2
- Looking for non-existing metadata HOT 3
- Rstudio abort when running "resample" HOT 1
- Why can't I download cmip6_tile? HOT 2
- future of the raster package HOT 1
- Example failure when running R CMD check (TopologyException) HOT 4
- Bilinear resample is slow, and surprisingly faster than ngb (nearest neighbour). HOT 2
- Mask function fail inside a for loop HOT 2
- writeRaster a RasterLayer object, Error in crs != "" : comparison (2) is possible only for atomic and list types HOT 2
- Is it possible to create a settings to make clusterR work with inDisk file
- Error using `compression` argument while writing a netCDF file (`writeRaster`)
- Error to transform shapfile to raster for interpolation HOT 1
- libproj
- How to convert continuous values into factor values in RasterStack type raster data? HOT 2
- Error converting subset of SpatRaster to RasterStack if out of memory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raster.