Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scotland dataset CRS #40

Open
simon-smart88 opened this issue Apr 10, 2024 · 0 comments
Open

Scotland dataset CRS #40

simon-smart88 opened this issue Apr 10, 2024 · 0 comments

Comments

@simon-smart88
Copy link

Hello. I wanted to use the Scotland dataset as an example dataset, but needed to convert to latitude/longitude first. I'd normally do that with sf::st_transform(scotland_sf, crs = 4326) but the result ends up plotted in the South Pacific and is very small:

library(leaflet)
library(SpatialEpi)

scot <- scotland_sf
scot <- sf::st_transform(scot, crs = 4326)
leaflet() %>%
  addProviderTiles("Esri.WorldTopoMap") %>%
  addPolygons(data = scot)

Looking at the raw values in the geometry, I noticed that the values looked 1000 times too small for eastings and northings and indeed transforming the values fixes the issue:

scot$geometry <- scot$geometry * 1000
scot <- sf::st_set_crs(scot, 27700) 
scot <- sf::st_transform(scot, crs = 4326)
leaflet() %>%
  addProviderTiles("Esri.WorldTopoMap") %>%
  addPolygons(data = scot)

Maybe I have misunderstood the original CRS, but if not you may want to consider converting the object with either the first two or three lines of the above. This was using the sf version, but I also noticed that the sp version has the same coordinates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant