I am trying to map the Lower-layer Super Output Area (LSOA)of London. I could only find the shapefiles in this address:


in the following zip file:


Below is the code I'm using to map the shapfiles using R.


lsao <- readOGR(dsn = "ESRI", layer = "LSOA_2011_London_gen_MHW") #Read the shapefiles from the ESRI folder

lsao %>% 
leaflet() %>%
  setView(-0.1000, 51.5,zoom = 10) %>% 
  addTiles() %>%

The above code just opens a Leaflet map with no polygons on the map. I have never had a problem mapping shapefiles using the above code and that's why I think there might be something wrong with the shapefiles on the UK government website. I was wondering if anyone has more information on this issue?

  • I can't see any shapefiles on that page - only CSV and XLS and ZIPs of those.
    – Spacedman
    Commented Jan 29, 2022 at 10:18
  • @Spacedman just updated the post.
    – Amin Shn
    Commented Jan 29, 2022 at 10:28
  • You don't say what you expect to happen from your code and what actually happens. Commented Jan 29, 2022 at 11:07
  • @bugmenot123 sorry, just updated the post.
    – Amin Shn
    Commented Jan 29, 2022 at 11:13

2 Answers 2


you can use below code:

lsao_london <- readOGR(dsn="folder name", layer="data name")
lsao_london <- spTransform(, CRS("+proj=longlat +datum=WGS84")) 

The data needs to be transformed to lat-long coordinates (EPSG:4326) to work with leaflet. For sp classes, use spTransform, but it is recommended you use sf package functions for spatial data, so read in with st_read and use st_transform to reproject.

  • Thank you, I am fairly new to these stuff, would you please share the correct code for reading the file and transforming it? I have no idea how to use st_read & st_transform.
    – Amin Shn
    Commented Jan 29, 2022 at 11:13
  • 1
    You're probably better off finding a tutorial for spatial data in R than for me to feed you code here. bookdown.org/robinlovelace/geocompr and go through a few chapters.
    – Spacedman
    Commented Jan 29, 2022 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.