Reputation: 685
I am editing a raster using the raster
and rdgal
packages in r.
However, after making the edits and saving the raster using the writeRaster
function I notice that it has changed the coordinate reference system from OSGB 1936 to Airy 1830.
Why is this happening and how do I prevent writeRaster
from doing this?
Upvotes: 0
Views: 75
Reputation: 47146
I see this:
library(raster)
r <- raster(nrow=10, ncol=10)
values(r) <- 1:ncell(r)
crs(r) <- "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs"
x <- writeRaster(r, "test.tif")
crs(x)
#CRS arguments:
#+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.1502,0.247,0.8421,-20.4894 +units=m +no_defs
So the coordinate reference system mostly remains the same (it is still transverse Mercator etc), but the datum=OSGB36
is dropped.
I do not why this happens, but I think it is the same thing (the OSGB36 datum is defined by the airy 1830 ellipsoid).
Upvotes: 1