I am trying to extract raster values using polygon layer with different CRS. Raster is in WGS84 (EPSG:4326) and the polygons in UTM (EPSG:23031).
1. If I want to work in the projection of the polygons, do the cells of the raster need to be resampled?
- I.e. is converting to different pixel grid, and thus information loss, necessary? Or can the GIS just reproject the edges of the raster cells and handle it without resampling?
2. Is there any general/prefered practice that the polygons are converted to the projection of the raster?
- E.g. to avoid raster resampling - if answer to question 1 is yes.
In other words, can we work in polygons' CRS without the need for raster resampling?
PS: my use case - I am using raster
library in R to do the job. R decides to automatically transform polygons:
> a <- extract(raster, polygons, weights = TRUE)
Warning message:
In .local(x, y, ...) :
Transforming SpatialPolygons to the CRS of the Raster
However, this means that the already projected polygons (which were actually created as a buffer in UTM projected plane) need to be converted back to WGS84 implicit latlong "projection"... I would prefer to work in the plane defined by UTM, because the projection is much less distorted for my purposes, e.g. weighting by areas would work with minimal distortion etc...
projectRaster(raster, crs = projection(polygons))
to the CRS of your polygons before executingextract
. However, I'd also appreciate appropriate answers regarding the above questions of yours.