zonebuilder is a package for exploring zoning systems. This document contains ideas on challenges that can be tackled using zoning systems, example code to get started and suggestions of how to get involved.
To ensure that you have the necessary software installed, try running the following lines of code in an R console (you need the latest version of the package):
::install_github("zonebuilders/zonebuilder")
remotes::install_github("itsleeds/pct") remotes
library(zonebuilder)
library(dplyr)
library(tmap)
tmap_mode("view")
Ideas for hackathon:
= pct::get_pct_zones("west-yorkshire")
zones_west_yorkshire = zones_west_yorkshire %>% filter(lad_name == "Leeds") zones_leeds_official
= tmaptools::geocode_OSM(q = "Leeds", as.sf = TRUE) leeds_centroid
You can get and plot the output of the preceding code chunk with:
= readRDS(url("https://github.com/zonebuilders/zonebuilder/releases/download/0.0.1/leeds_centroid.Rds"))
leeds_centroid = readRDS(url("https://github.com/zonebuilders/zonebuilder/releases/download/0.0.1/zones_leeds_official.Rds"))
zones_leeds_official = zones_leeds_official %>%
zone_outline ::st_buffer(dist = 0.0001) %>%
sf::st_union()
sf= zb_zone(x = zone_outline, point = leeds_centroid)
zones_leeds_zb tm_shape(zones_leeds_zb) + tm_borders() +
tm_text("label")
The zoning systems works well to represent cities that have a clear centre (monocentric cities) with city zones connected by radial and circular orbital routes, such as Erbil:
= "Erbil"
city_name = tmaptools::geocode_OSM(city_name, as.sf = TRUE)
city_centre = zb_zone(point = city_centre, n_circles = 5)
zones_erbil tm_shape(zones_erbil) + tm_borders() +
tm_text("label") +
tm_basemap(server = leaflet::providers$OpenStreetMap)
# zb_view(zones_erbil)
The zoning system works less well for other cities, e.g. cities with asymetric and polycentric urban morphologies such as Dhakar, shown below.
= "Dhaka"
city_name = tmaptools::geocode_OSM(city_name, as.sf = TRUE)
city_centre = zb_zone(point = city_centre, n_circles = 5)
zones_dhaka tm_shape(zones_dhaka) + tm_borders() +
tm_text("label") +
tm_basemap(server = leaflet::providers$OpenStreetMap)
::install_github("itsleeds/geofabrik")
devtoolslibrary(geofabrik)
= get_geofabrik(leeds_centroid, layer = "multipolygons", key = "shop", value = "supermarket") leeds_shop_polygons
We have pre-saved the results as follows:
= readRDS(url("https://github.com/zonebuilders/zonebuilder/releases/download/0.0.1/leeds_shop_polygons.Rds"))
leeds_shop_polygons = zb_zone(zones_leeds_official, point = leeds_centroid, n_circles = 5)
z = aggregate(leeds_shop_polygons["shop"], z, FUN = length)
z_supermarkets tm_shape(z_supermarkets) +
tm_polygons("shop", alpha = 0.5, title = "N. Supermarkets")
Robin to create UK example