Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Raster is a data format consisting of regular grids of values, usually stored in an image-like format.
3
votes
Accepted
R export raster to png without margin
Well, I had to do it in the most bizarre way I found, which was creating a 3D array, and saving it to PNG:
m <- array(NA,c(nrow(country),ncol(country),3))
m[,,1] <- matrix(strtoi(paste('0x',substr(co …
1
vote
1
answer
383
views
QGIS raster calculator not keeping each pixel with 1 byte? [closed]
I have a raster where 1 pixel = 1 byte. I want to change every value different than zero to 1, transforming a gray scale into black & white. …
7
votes
2
answers
7k
views
R export raster to png without margin
library(raster)
library(rgdal)
r <- raster('gm_lc_v3.tif')
p <- readOGR('ne_10m_admin_0_countries','ne_10m_admin_0_countries')
i <- 66 # Dominican Republic
country <- crop(r,p[i,])
png(paste(p$GEOUNIT[ … But since the margins are being added, my image is not representing the raster correctly. I want each pixel in the raster to become a pixel in the image. …
1
vote
0
answers
1k
views
Why is R writeRaster function with GTiff format so slow?
I've downloaded a countries shapefile from Natural Earth, and used it to clip GLC2000 raster using Brazil's border as the mask (in R). … setwd('~/R/GLC2000')
library(rgdal)
library(raster)
glc <- raster('glc2000_v1_1')
pa <- readOGR('.. …
3
votes
0
answers
2k
views
Draw shapefile over PNG image in R
My first thought was to convert the PNG (it's read as a three-layered matrix, for red, green and blue) to a raster. But creating a three-layered raster may be an overkill. …
3
votes
2
answers
4k
views
How to mix two raster in R (same extent)?
The pixel colors come from a raster that describes the vegetation, and the boundaries of the countries come from a shapefile. … I managed to do almost all of it using the raster and rgdal libraries in R:
library(raster)
r <- raster('gm_lc_v3.tif')
library(rgdal)
p <- readOGR('ne_10m_admin_0_countries','ne_10m_admin_0_countries …
0
votes
Accepted
How to mix two raster in R (same extent)?
Worked with merge, only the colortable was missing:
m3 <- merge(m1,m2)
m3@legend@colortable <- m1@legend@colortable
plot(m3)
or
m3 <- merge(m1,m2)
m3@legend <- m1@legend
plot(m3)
1
vote
1
answer
549
views
How to crop raster in R without losing the colors?
I have a 2x3 raster in R, with values 1 to 6. … library(raster)
r <- raster(nrows=3,ncols=2,xmn=0,xmx=2,ymn=0,ymx=3,vals=1:6)
colors <- c('red','orange','yellow','green','blue','purple')
plot(r,col=colors)
Now if I clip the raster, leaving the first …