cents <- rgdal::readOGR(dsn = "~/repos/pct/pct-data/national/cents.geojson", layer = "OGRGeoJSON")
# library(geojsonio) # load with the ropensci package geojsonio if rgdal fails
# cents <- geojsonio::geojson_read(x = "~/repos/pct/pct-data/national/cents.geojson")
crs <- CRS("+init=epsg:4326")
crsuk <- CRS("+init=epsg:27700")
cents <- sp::spTransform(x = cents, CRSobj = crsuk)
home <- rev(RgoogleMaps::getGeoCode("LS7 3HB"))
home <- sp::SpatialPoints(coords = home, proj4string = crs)
home <- sp::spTransform(x = home, CRSobj = crsuk)
buf <- rgeos::gBuffer(home, width = 2000)
# Check it saved the points OK
cents <- cents[buf,]
plot(buf)
points(cents)
cents <- sp::spTransform(x = cents, CRSobj = crs)
library(devtools)
use_data(cents)
Run the code above in your browser using DataLab