diff --git a/script.R b/script.R index f154c9e..1c1855b 100755 --- a/script.R +++ b/script.R @@ -3,15 +3,14 @@ require(sf) # Load admin polygons: oa11 <- st_read("./data/infuse_oa_lyr_2011.shp") - # download 2011 LSOA polygons - level 2 lsoa11 <- st_read("./data/infuse_lsoa_lyr_2011.shp") - # download local authorities data for whole UK - level 1 (least detailed) local_authorities <- st_read("data/infuse_dist_lyr_2011.shp") - # Load buildings shapefile: buildings <- st_read("./data/OS_Open_Zoomstack_district_buildings.gpkg") +# open country shapefiles +countries <- st_read("data/infuse_ctry_2011.shp") # Create modest buffer around quite small building polygons for the sake of visualisation at very large scale where small polygons can appear as points buffer <- st_buffer(buildings,150) @@ -25,9 +24,11 @@ st_write(difference, "data/local_authorities_cropped_union_buffer_150.gpkg") inversion <- st_difference(local_authorities$geom, difference) # Write results to a file: st_write(inversion, "data/local_authorities_cropped_union_buffer_150_inverted.gpkg") +# Create simplified version: +inversion_simplified = st_simplify(inversion, dTolerance = 150) # 150 m +st_write(inversion_simplified, "data/local_authorities_cropped_union_buffer_150_inverted_simplified.gpkg") + -# open country shapefiles -countries <- st_read("data/infuse_ctry_2011.shp") # Create modest buffer around quite small building polygons for the sake of visualisation at very large scale where small polygons can appear as points buffer <- st_buffer(buildings,150) # Dissolve and merge overlapping shapes @@ -40,3 +41,6 @@ st_write(difference, "data/countries_cropped_union_buffer_150.gpkg") inversion <- st_difference(countries$geom, difference) # Write results to a file: st_write(inversion, "data/countries_cropped_union_buffer_150_inverted.gpkg") +# Create simplified version: +inversion_simplified = st_simplify(inversion, dTolerance = 150) # 2000 m +st_write(inversion_simplified, "data/countries_cropped_union_buffer_150_inverted_simplified.gpkg")