raster

R - rasters with same crs, extent, dimension, resolution do not align

佐手、 提交于 2019-12-20 06:27:34
问题 I am finding the average production days per year for maple syrup. My maple distribution data is in an ascii file. I have a raster (created from NetCDF files) called brick.Tmax . I want to match the specs of brick.Tmax to my maple distribution data. ## These are the specs I want to use for my maple distribution brick.Tmax class : RasterBrick dimensions : 222, 462, 102564, 366 (nrow, ncol, ncell, nlayers) resolution : 0.125, 0.125 (x, y) extent : -124.75, -67, 25.125, 52.875 (xmin, xmax, ymin,

Manipulating a colored image in matrix form in java

£可爱£侵袭症+ 提交于 2019-12-20 03:55:12
问题 I am working on a project related to colored image manipulation using JAVA. I got to know the conversion of the colored image into a matrix using a getSample method of Raster class, pixels[x][y]=raster.getSample(x,y,0); I got the matrix in pixels[][] (only the values in red band). Then i converted the matrix back to image using WritableRaster as, raster.setSample(i,j,0,pixels[i][j]); I converted it to image using, * BufferedImage image=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB); image

How to fix poor interpolation of very small rasters in viewed pdfs (evince and chrome)

让人想犯罪 __ 提交于 2019-12-20 03:17:24
问题 I want to create a visualization of a matrix for some academic work. I decided to go about this by having the pixels in the image correspond to the values in the matrix. I created the nice small png that follows: When properly scaled up, you get a very reasonable image: This is a screenshot from within inkscape. However, when export this as a pdf, both evince and chrome do a terrible job at upscaling what should be very trivial, and instead I get something that looks like: The pdf itself

How to change a Lambert Conic Conformal raster projection to latlon degree R

白昼怎懂夜的黑 提交于 2019-12-20 02:38:38
问题 I have a raster, obtained from a netcdf which is in (Lambert Conic Conformal projection): library(meteoForecast) wrf_temporary <- getRaster("temp", day = Sys.Date(), frames = 'complete', resolution = 36, service = "meteogalicia") wrf_temporary extent : -18, 4230, -18, 3726 (xmin, xmax, ymin, ymax) coord. ref. : +proj=lcc +lat_1=43 +lat_2=43 +lat_0=34.82300186157227 +lon_0=-14.10000038146973 +x_0=536402.34 +y_0=-18558.61 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=km +no_defs Now I want to

ploting artefact with points over raster

孤人 提交于 2019-12-19 07:23:06
问题 I noticed some weird behavior when resizing the plot window. Consider library(sp) library(rgeos) library(raster) rst.test <- raster(nrows=300, ncols=300, xmn=-150, xmx=150, ymn=-150, ymx=150, crs="NA") sap.krog300 <- SpatialPoints(coordinates(matrix(c(0,0), ncol = 2))) sap.krog300 <- gBuffer(spgeom = sap.krog300, width = 100, quadsegs = 20) shrunk <- gBuffer(spgeom = sap.krog300, width = -30) shrunk <- rasterize(x = shrunk, y = rst.test) shrunk.coords <- xyFromCell(object = rst.test, cell =

Shapefile to raster conversion in R?

≡放荡痞女 提交于 2019-12-19 05:55:11
问题 I have a shapefile downloaded from the worldwildlife.org for the terrestrial ecoregions of the world. The file can be loaded here: http://worldwildlife.org/publications/terrestrial-ecoregions-of-the-world. It comes as a standard shape file and I would like to do two things with it. First: take the shapefile from my local directory and clip it to an extent of eastern North America (ext= extent (-95, -50, 24, 63)) # Read shapefile using package "maptools" eco_shp <- readShapeLines("F:/01_2013

R - original colours of georeferenced raster image using ggplot2- and raster-packages

余生颓废 提交于 2019-12-19 03:42:13
问题 I would like to use the original colortable of a >>georeferenced raster image<< (tif-file) as coloured scale in a map plotted by ggplot/ggplot2 . Due to not finding an easier solution, I accessed the colortable -slot from the legend -attribute of the loaded raster image (object) raster1 like so: raster1 <- raster(paste(workingDir, "/HUEK200_Durchlaessigkeit001_proj001.tif", sep="", collapse="")) raster1.pts <- rasterToPoints(raster1) raster1.df <- data.frame(raster1.pts) colTab <- attr

How to project and resample a grid to match another grid with GDAL python?

徘徊边缘 提交于 2019-12-18 10:23:10
问题 Clarification: I somehow left out the key aspect: not using os.system or subprocess - just the python API. I'm trying to convert a section of a NOAA GTX offset grid for vertical datum transformations and not totally following how to do this in GDAL with python. I'd like to take a grid (in this case a Bathymetry Attributed Grid, but it could be a geotif) and use it as the template that I'd like to do to. If I can do this right, I have a feeling that it will greatly help people make use of this

Pixel by pixel Bézier Curve

旧时模样 提交于 2019-12-17 23:14:17
问题 The quadratic/cubic bézier curve code I find via google mostly works by subdividing the line into a series of points and connects them with straight lines. The rasterization happens in the line algorithm, not in the bézier one. Algorithms like Bresenham's work pixel-by-pixel to rasterize a line, and can be optimized (see Po-Han Lin's solution). What is a quadratic bézier curve algorithm that works pixel-by-pixel like line algorithms instead of by plotting a series of points? 回答1: A variation

convert matrix to raster in R

心不动则不痛 提交于 2019-12-17 18:58:40
问题 I have a matrix data with spatial coordinates and one variable. The spatial resolution is 1000 meters. > str(dat1) > List of 3 > $ x: num [1:710] 302340 303340 304340 305340 306340 ... > $ y: num [1:1241] 5431470 5432470 5433470 5434470 5435470 ... > $ z: num [1:710, 1:1241] 225 225 225 225 225 ... I want to convert it into raster format. > dat1$x[1:10] > [1] 302339.6 303339.6 304339.6 305339.6 306339.6 307339.6 308339.6 309339.6 310339.6 311339.6 > dat1$y[1:10] > [1] 5431470 5432470 5433470