[R-sig-Geo] Converting longitude and latitude to UK OS references
Roger Bivand
Roger@B|v@nd @end|ng |rom nhh@no
Sun Oct 23 11:37:17 CEST 2022
Please see https://doi.org/10.1007/s10109-020-00336-0 for the details, and/or
https://cran.r-project.org/web/packages/rgdal/vignettes/CRS_projections_transformations.html. Please try to use sf rather than sp, but both need the proj CDN turned on to access transformation grids. Without the grid(s), the transformation will be off by 1.5m or 120m if only ballpark accuracy.
https://r-spatial.org/book/02-Spaces.html and subsequent sections may also help.
Please report back with progress or questions.
Roger
---
Roger Bivand
Emeritus Professor
Department of Economics
Norwegian School of Economics, Bergen, Norway
________________________________
Fra: R-sig-Geo <r-sig-geo-bounces using r-project.org> p� vegne av Nick Wray <nickmwray using gmail.com>
Sendt: s�ndag 23. oktober 2022, 11:09
Til: r-sig-geo using r-project.org <r-sig-geo using r-project.org>
Emne: [R-sig-Geo] Converting longitude and latitude to UK OS references
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]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo using r-project.org
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-geo&data=05%7C01%7CRoger.Bivand%40nhh.no%7C19c396cda2a44a1b3b8008dab4d64ad0%7C33a15b2f849941998d56f20b5aa91af2%7C0%7C0%7C638021129721378036%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=rJYOSr6oi6lBO0WGc7BVFuyj9ZMkpbt8NK3xR0L2O28%3D&reserved=0
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list