rgdal issue - other solutions for UK maps

Hi,
I have this code which has been working:

NPS.by.Region <- data.frame(
  stringsAsFactors = FALSE,
            Region = c("East Midlands",
                       "East of England","London","North East","North West",
                       "Northern Ireland","Scotland","South East","South West","Wales",
                       "West Midlands","Yorkshire and The Humber"),
          AVER.NPS = c(80.3990610328639,
                       65.3417015341702,65.8536585365854,86.61800486618,72.6201269265639,
                       80,80.9663250366032,71.0091743119266,76.8518518518518,
                       79.4721407624633,75.2092050209205,76.1425959780622),
             Count = c(852,1434,451,411,1103,135,
                       683,2180,972,341,956,1094)
)

NPS.by.Region

library(rgdal)
eng1 <- rgdal::readOGR(paste0("https://opendata.arcgis.com/datasets/",
                              "8d3a9e6e7bd445e2bdcc26cdf007eac7_4.geojson"))

countries1 <- rgdal::readOGR(paste0("https://opendata.arcgis.com/datasets/",
                                    "92ebeaf3caa8458ea467ec164baeefa4_0.geojson"))

eng <- sf::st_as_sf(eng1)
countries <- sf::st_as_sf(countries1)
UK <- countries[-1,] 
names(eng)[3] <- "Region"
names(UK)[3] <- "Region"
UK$objectid <- 10:12
eng <- eng[-2]
UK <- UK[c(1, 3, 9:11)]
UK <- rbind(eng, UK)



library(dplyr)
ukj <- left_join(UK,NPS.by.Region)

ggplot2::ggplot(ukj, ggplot2::aes(fill = AVER.NPS)) + 
  ggplot2::geom_sf() +
  ggplot2::scale_fill_gradient(low="#CC0000", high = "#006600")

Now, there are some issues with rgdal or something else as I cannot run it anymore.

Can anyone help?

It seems like it cannot find the data sources any longer - the download links from ArcGIS Hub seem to be broken.

Maybe try and download the data and reference the downloaded data from your code to introduce more reproducibility ?

This is the problem as I used this part of the code:

library(rgdal)
eng1 <- rgdal::readOGR(paste0("https://opendata.arcgis.com/datasets/",
                              "8d3a9e6e7bd445e2bdcc26cdf007eac7_4.geojson"))

countries1 <- rgdal::readOGR(paste0("https://opendata.arcgis.com/datasets/",
                                    "92ebeaf3caa8458ea467ec164baeefa4_0.geojson"))

from one of the codes available in the R community.
I was using that for a while. It stopped working and I cannot fix it.
Perhaps there is another way of creating UK region maps without this code?

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.