[R-sig-Geo] Converting longitude and latitude to UK OS references

Nick Wray n|ckmwr@y @end|ng |rom gm@||@com
Sun Oct 23 11:08:51 CEST 2022


I am trying to convert longitude and latitude values for UK weather
stations to UK Ordnance Survey National Grid References.  There are sites
where one can do them one at a time but I have a large number.  I have
found some code which does the conversion and include the first three
points which I want to convert as an example

library(sp)
xy<-as.data.frame(cbind(c(55.8533,55.8551,55.8473),c(-2.38588,-2.39620,-2.11304)))
colnames(xy)<-c("lon","lat")
xy
coordinates(xy)<-~lon+lat
## see site in jounral convert llon lat
proj4string(xy)<-CRS("+init=epsg:4326")
ptsOS<-spTransform(xy,CRS("+init=epsg:27700"))
ptsOS

but it doesn't give the right answers - the output doesn't correspond to
either what I get whn I put an individual point into a conversion site nor
with other points in the same region which I have got from other sources
and are mutually compatible

Can anyone explain where I'm going wrong and how I can fix this?  Thanks
Nick Wray

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list