r-raster

How to properly project and plot raster in R

旧街凉风 提交于 2021-02-20 20:00:02
问题 I have a raster in an equal area Behrmann projection and I would like to project it to the Mollweide projection and plot. When I do this with the following code, however, the plotting doesn't seem right, as the map extends to the sides, and there are outlines of various landmasses where I wouldn't expect them.Also, the map extends beyond the plot window. Can anyone please help me get this to plot nicely? Thanks! The data file used can be downloaded from this link. Here is the code I have so

How to properly project and plot raster in R

一笑奈何 提交于 2021-02-20 19:59:26
问题 I have a raster in an equal area Behrmann projection and I would like to project it to the Mollweide projection and plot. When I do this with the following code, however, the plotting doesn't seem right, as the map extends to the sides, and there are outlines of various landmasses where I wouldn't expect them.Also, the map extends beyond the plot window. Can anyone please help me get this to plot nicely? Thanks! The data file used can be downloaded from this link. Here is the code I have so

R: RasterToPolygon works slow, then stop working

允我心安 提交于 2021-02-10 13:45:57
问题 I have a problem to process rasters in R, even if I've done it previously. I can read the data and plot them: however, when I tried to convert my raster to polygon, the R stops working I've tried to update packages, re-install R, on OSX, on Windows 7, always with the same result. Moreover, I've tried to set my projection to NA, but this neither helped. Did you ever experienced problem like this? Do you have some suggestions how to solve the problem? I highly appreciate any suggestions ! MY

R: RasterToPolygon works slow, then stop working

和自甴很熟 提交于 2021-02-10 13:45:25
问题 I have a problem to process rasters in R, even if I've done it previously. I can read the data and plot them: however, when I tried to convert my raster to polygon, the R stops working I've tried to update packages, re-install R, on OSX, on Windows 7, always with the same result. Moreover, I've tried to set my projection to NA, but this neither helped. Did you ever experienced problem like this? Do you have some suggestions how to solve the problem? I highly appreciate any suggestions ! MY

Why does rasterToPoints generate an error on first call but not second?

筅森魡賤 提交于 2021-02-08 07:32:20
问题 I have some code that loops over a list of study IDs ( ids ) and turns them into separate polygons/spatial points. On the first execution of the loop it produces the following error: Error in (function (x) : attempt to apply non-function This is from the raster::rasterToPoints function. I've looked at the examples in the help section for this function and passing fun=NULL seems to be an acceptable method (filters out all NA values). All the values are equal to 1 anyways so I tried passing a

Why does rasterToPoints generate an error on first call but not second?

两盒软妹~` 提交于 2021-02-08 07:32:09
问题 I have some code that loops over a list of study IDs ( ids ) and turns them into separate polygons/spatial points. On the first execution of the loop it produces the following error: Error in (function (x) : attempt to apply non-function This is from the raster::rasterToPoints function. I've looked at the examples in the help section for this function and passing fun=NULL seems to be an acceptable method (filters out all NA values). All the values are equal to 1 anyways so I tried passing a

overlay rasters at a given value

余生颓废 提交于 2021-02-08 06:15:30
问题 I am relatively new to using R and working with GIS data. I am trying to create a function to overlay two Raster layers, only when one of the rasters (in this case raster1 ) is at a certain value (in this case 0). I have tried numerous options in doing this but they don't seem to work. My last attempt is provided below, and it runs but the output just says NULL and it does not plot. library(raster) raster1 <- raster(ncols=10,nrows=10) raster2 <- raster(ncols=10,nrows=10) values(raster1) <-

overlay rasters at a given value

浪尽此生 提交于 2021-02-08 06:15:10
问题 I am relatively new to using R and working with GIS data. I am trying to create a function to overlay two Raster layers, only when one of the rasters (in this case raster1 ) is at a certain value (in this case 0). I have tried numerous options in doing this but they don't seem to work. My last attempt is provided below, and it runs but the output just says NULL and it does not plot. library(raster) raster1 <- raster(ncols=10,nrows=10) raster2 <- raster(ncols=10,nrows=10) values(raster1) <-

How can I fix “Error: Failure during raster IO”?

六月ゝ 毕业季﹏ 提交于 2021-01-29 04:57:17
问题 I'm trying to working with 12 high resolution LANDSAT images at 30m resolution (1.4 Gb per image) as covariates in a species distribution model. But I get the following error: “Error: Failure during raster IO” when extracting values from my raster stack. library(raster) preds <- suppressWarnings( raster::stack(files)) envtrain <- extract(preds, train) I read some suggestion to reduce the images area, but it's not good for me. 回答1: This almost certainly means that your raster file is corrupted

Error using calc() function: cannot use this function

坚强是说给别人听的谎言 提交于 2021-01-28 09:08:09
问题 I need to run calculations on large multi-band rasters and export a RasterBrick, and am trying to do so using the calc() function in the raster package, for the purpose of memory efficiency. The function runs fine on its own, but when I try to include it in calc() , I keep getting this error: Error in .calcTest(x[1:5], fun, na.rm, forcefun, forceapply) : cannot use this function How can I make this work? Simplified code: fn = system.file("external/test.grd", package="raster") s = stack(fn, fn