Or use
?stars::st_transform
The EPSG for OSGB36 is 27700 (https://epsg.io/27700), so something like...
newraster <- st_transform(raster, CRS=27700)
should work, but you might also want to look at st_warp() if you need a
regular grid in your new (OS) raster
Cheers
Rob
*** Learn about
Try:
library(raster)
new_raster<-spTransform(old_raster,CRS("+proj=longlat +ellps=airy +no_defs"))
Good luck
Alaba
From: R-sig-Geo on behalf of Nick Wray
Sent: November 29, 2022 10:25 AM
To: r-sig-geo@r-project.org
Subject: [R-sig-Geo] Coverting CRS in R to
Hello I have shapefile data (of the river Tweed catchment in N England
and Scotland) which I have been able to plot precipitation and temperature
data onto without too many problems. These data have the OSGB 1936/British
National Grid CRS projection.
But I now have a raster of land cover (from
Ah ha, its a file with no line endings. Count the lines, zero:
$ wc -l countrymasks.geojson
0 countrymasks.geojson
Although adding a line ending to the file still produces the error.
Hmm. Even running it through `json_pp` to get it on multiple lines
results in the error:
$ more countrymasks_pp.
Interestingly, what seems to works is
readLines('countrymasks.geojson') |> st_read() -> r
with a warning:
Warning message:
In readLines("countrymasks.geojson") :
incomplete final line found on 'countrymasks.geojson'
On 29/11/2022 00:58, Miluji Sb wrote:
Thank you. I will report this bug (I