raster

Create hexagonal grid over city and associate with lon / lat points (in R)

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-09 08:33:13
问题 I've been researching this for a while now but haven't come across any solution that fit my needs or that I can transform sufficiently to work in my case: I have a large car sharing data set for multiple cities in which I have the charging demand per location (e.g. row = carID, 55.63405, 12.58818, charging demand). I now would like to split the area over the city (example above is Copenhagen) up into a hexagonal grid and tag every parking location with an ID (e.g. row = carID, 55.63405, 12

predict with glmer where new data is a Raster Stack of fixed efefcts

旧城冷巷雨未停 提交于 2021-02-08 11:59:30
问题 I have constructed models in glmer and would like to predict these on a rasterStack representing the fixed effects in my model. my glmer model is in the form of: m1<-glmer(Severity ~ x1 + x2 + x3 + (1 | Year) + (1 | Ecoregion), family=binomial( logit )) As you can see, I have random effects which I don't have as spatial layer - for example 'year'. Therefore the problem is really predicting glmer on rasterStacks when you don't have the random effects data random effects layers. If I use it out

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) <-

R Assigning x or y coordinate to cells of a raster to perform calculations

大憨熊 提交于 2021-02-05 06:35:29
问题 Is there any solution to assign to assign X or Y coordinate to all of the cells of a raster image using R? For example, suppose I have a raster with 3x3 cells. The lower left coordinate is X=7,Y=15 (in meters), and resolution is +10 m for both, X and Y direction (X increases rightward, and Y upward). Then, I would like to generate raster surfaces where each cell has the X and Y value, like these ones: X raster 7 17 27 7 17 27 7 17 27 Y surface 35 35 35 25 25 25 15 15 15 UPDATE: this is the

R Assigning x or y coordinate to cells of a raster to perform calculations

女生的网名这么多〃 提交于 2021-02-05 06:35:13
问题 Is there any solution to assign to assign X or Y coordinate to all of the cells of a raster image using R? For example, suppose I have a raster with 3x3 cells. The lower left coordinate is X=7,Y=15 (in meters), and resolution is +10 m for both, X and Y direction (X increases rightward, and Y upward). Then, I would like to generate raster surfaces where each cell has the X and Y value, like these ones: X raster 7 17 27 7 17 27 7 17 27 Y surface 35 35 35 25 25 25 15 15 15 UPDATE: this is the

How to make RASTER from irregular point data without interpolation

醉酒当歌 提交于 2021-02-05 05:21:14
问题 I was trying to make a raster image from an irregularly spaced point database. The data looks like- > head(s100_ras) x y z 1 267573.9 2633781 213.29545 2 262224.4 2633781 69.78261 3 263742.7 2633781 51.21951 4 259328.4 2633781 301.98413 5 264109.8 2633781 141.72414 6 255094.8 2633781 88.90244 I want these 'z' values within a mesh which I created by # Create a fine mesh grid my_mesh=expand.grid(seq(min(s100_ras$Y),max(s100_ras$Y),l=100), seq(min(s100_ras$X),max(s100_ras$X),l=100)) I also want

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

Predicting to raster stack at population level with glmmTMB in R

风流意气都作罢 提交于 2021-01-28 06:23:29
问题 I'm trying to predict to a raster stack in R, using a GLMM I fit with the glmmTMB package, at the population level (i.e. setting random effects to 0). I followed Ben Bolker's solution in this thread which works for models fit with lme4 , but even though the function argument re.form=~0 appears to be applicable to predict.glmmTMB in addition to predict.merMod , it's not working for me when I predict using a glmmTMB model. Here is an example using the same example code provided by Robert

How to convert raster byte array of an image to original image in java?

孤街浪徒 提交于 2021-01-28 01:43:35
问题 I need to convert bytes of an image to original image. My byte array which is created by WritableRaster.And Itried to convert to original form ,but it produced image without original colors.My tries are below try { BufferedImage readImage = ImageIO.read(new File("C:\\Users\\Public\\Pictures\\Sample Pictures\\Desert.jpg")); byte imageData[] = get_byte_data(readImage); // Then I need to convert this to original image DataBuffer buffer = new DataBufferByte(imageData, imageData.length);