raster

R raster package split image into multiples

天大地大妈咪最大 提交于 2019-12-09 06:42:57
问题 I have an image as below. It is 2579*2388 pixels. Lets assume that it's bottom left corner is at 0,0. From that image I want to create multiple images as follows and save them in the working folder. Each image will have size of 100*100 pixels. Each image will be saved by it's bottom left hand coordinates. first image will have its bottom left hand corner at 0,0. Top right hand corner will be at 100,100 and the image will be saved as 0-0.jpg second will have its bottom left hand corner at 10,0

JMapViewer, load raster to a position

萝らか妹 提交于 2019-12-08 12:52:37
问题 I would like to load and display a raster file over the map in the JMapViewer. The raster file: should be loaded at a specific position, size dynamically changes using the zoom operations, I hope these operations are supported by JMapViewer. Currently, I am using a class derived from the MapMarkerCircle: public class ImageViewer extends MapMarkerCircle implements MapMarker { private BufferedImage img; public ImageViewer(Coordinate position, BufferedImage img) { this(position, 1, img);} public

Can not open created raster in R

自古美人都是妖i 提交于 2019-12-08 11:46:19
问题 I have two issues related to the error: first : I have one merged dem layer and multiple shapefiles, I create a list of masked shapefiles boundary, I was able to plot all of them except one "the first one" which is the biggest one: > plot(DEM_masked_list[[1]]) Error in file(fn, "rb") : cannot open the connection In addition: Warning message: In file(fn, "rb") : cannot open file '/private/var/folders/2w/rjzwcrbn3pg0jmsrfkz7n52h0000gn/T/RtmpkL8Ot5/raster/r_tmp_2018-01-29_014745_982_20879.gri':

Reproject Raster Image from equirectagular to latlon using R

血红的双手。 提交于 2019-12-08 08:17:23
问题 Hi i been trying to reproject a raster image from Equirectangular to EPSG:4326 (Latlon), the issue is that every time i run my code on R, i get the wrong coordinates on the new image; i don´t know where is the error in the code, also i do the same process with Qgis, and i got the same result, it´s strange, i got the opportunity to do the same reprojection process in ENVI, and the result was succesful, help please!!! a <- raster("C:/Users/<username>/Documents/imageexample.tif") > a class :

ggplot2: dealing with extremes values by setting a continuous color scale

大城市里の小女人 提交于 2019-12-08 02:08:03
问题 I am trying to plot some global maps (raster files) and I have some problems in setting up a good color scale for my data. What I would like to do is to plot my data using a divergent palette (e.g. cm.colors ), and I would like to center the color "white" of such scale with the value zero, but without having to set symmetric values in the scale (i.e. the same value both negative and positive, i.e. limits=c(-1,1) ). Additionally, I would like to plot all values above and/or below a certain

get cell number within a distance of one point (raster)

落花浮王杯 提交于 2019-12-07 20:53:51
问题 I need to get the cell numbers within a distance (e.g., 10 km) of one point using R, but I didn't figure out how to handle it for the raster data. library(raster) r <- raster(ncols=10, nrows=10) cellFromXY(r, c(2,2)) # get the cell number of one point How to get the cell numbers within a distance of one point? 回答1: Use extract with the buffer option and cellnumbers=TRUE r <- raster(ncols=100, nrows=100) r[]<-runif(ncell(r)) xy <- cbind(-50, seq(-80, 80, by=20)) extract(r, xy[1:3,], buffer

How to create Image From Array of Pixel Values and known width and height..?

独自空忆成欢 提交于 2019-12-07 20:25:14
问题 I have 1D array of pixel values and i can get red, green and blue this way. int rgb[] = new int[] { (argb >> 16) & 0xff, //red (argb >> 8) & 0xff, //green (argb ) & 0xff //blue }; I know width height of image as well which I want to create. So, in total I have following data. 1) width of new image 2) height of new image 3) one dimension array of pixel value. My supervisor has advised me to use createRaster method but function arguments are hard to understand for me. Can you suggest me some

Function to sum each grid cells of raster stack using other rasters as an indicator

删除回忆录丶 提交于 2019-12-07 18:58:27
问题 ## input raster s <- stack(list.files("~/dailyraster", full.names=TRUE)) # daily raster stack r_start <- raster("~/stackSumSTART.asc") # this raster contain starting Julian day r_end <- raster("~/stackSumEND.asc") # this raster contain ending Julian day noNAcells <- which(!is.na(r[])) # cell numbers which contain values ## dummy raster x <- r x[] <- NA ## loop for (i in noNAcells) { x[i] <- sum(s[[r_start[i]:r_end[i]]][i]) } I would like to create a function like stackApply() , but I want it

R - get a specific band of a RasterLayer

ⅰ亾dé卋堺 提交于 2019-12-07 16:41:04
问题 A have a RasterLayer with 4 bands: >rx<-raster("/media/karimdion/Passport/Essais/po_3804017_bgrn_0000000 tif") > str(rx) Formal class 'RasterLayer' [package "raster"] with 12 slots @ file :Formal class '.RasterFile' [package "raster"] with 12 slots @ nbands : int 4 @ bandorder : chr "BIL" @ data :Formal class '.SingleLayerData' [package "raster"] with 13 slots @ min : num 0 @ max : num 65535 @ band : int 1 @ history : list() @ title : chr(0) @ extent :Formal class 'Extent' [package "raster"]

Create a WritableRaster based on int array

醉酒当歌 提交于 2019-12-07 14:09:00
问题 I need to take an int array and turn it into BufferImage. I really don't have any background on this subject and I learn it all from the internet so here's what I'm trying to do: Create an array from BufferedImage(done), turn this array into IntBuffer(done) - (Later i'll need to do some opertions on the image through the IntBuffer), put the changed values from the IntBuffer in new array(done), and turn this array into WritableRaster. (If something isn't right in my understading of the process