Title: | Create and Explore Geographic Zoning Systems |
---|---|
Description: | Functions, documentation and example data to help divide geographic space into discrete polygons (zones). The functions are motivated by research into the merits of different zoning systems <doi:10.1068/a090169>. A flexible 'ClockBoard' zoning system is provided, which breaks-up space by concentric rings and radial lines emanating from a central point. By default, the diameter of the rings grow according the triangular number sequence <doi:10.1080/26375451.2019.1598687> with the first 4 'doughnuts' (or 'annuli') measuring 1, 3, 6, and 10 km wide. These annuli are subdivided into equal segments (12 by default), creating the visual impression of a dartboard. Zones are labelled according to distance to the centre and angular distance from North, creating a simple geographic zoning and labelling system useful for visualising geographic phenomena with a clearly demarcated central location such as cities. |
Authors: | Robin Lovelace [aut, cre] , Martijn Tennekes [aut] |
Maintainer: | Robin Lovelace <[email protected]> |
License: | GPL-3 |
Version: | 0.0.2.9001 |
Built: | 2024-11-12 06:13:14 UTC |
Source: | https://github.com/zonebuilders/zonebuilder |
'london_a()' and 'london_c()' return the city boundaries and centre point of London, respectively.
london_a() london_c()
london_a() london_c()
'london_a()' returns a projected version of 'lnd' in 'spDataLarge'. See the ‘data-raw' folder in the package’s repo to reproduce these datasets The 'lonlat' versions of the data have coordinates in units of degrees.
plot(london_a(), reset = FALSE) plot(london_c(), add = TRUE)
plot(london_a(), reset = FALSE) plot(london_c(), add = TRUE)
The first 100 in the sequence of [triangular numbers](https://en.wikipedia.org/wiki/Triangular_number)
See the ‘data-raw' folder in the package’s repo to reproduce these datasets
This function generates colors for zones.
zb_color(z, palette = c("rings", "hcl", "dartboard"))
zb_color(z, palette = c("rings", "hcl", "dartboard"))
z |
An 'sf' object containing zones covering the region |
palette |
Palette type, one of |
A vector of colors
z = zb_zone(london_c(), london_a()) zb_color(z) plot(z[, "circle_id"], col = zb_color(z))
z = zb_zone(london_c(), london_a()) zb_color(z) plot(z[, "circle_id"], col = zb_color(z))
Make doughnuts
zb_doughnut( x = NULL, area = NULL, n_circles = NA, distance = 1, distance_growth = 1 )
zb_doughnut( x = NULL, area = NULL, n_circles = NA, distance = 1, distance_growth = 1 )
x |
Centre point. Should be an |
area |
(optional) Area. Should be an |
n_circles |
Number of rings including the central circle. By default 5, unless |
distance |
Distance The distances between the circles. For the center circle, it is the distance between the center and the circle. If only one number is specified, |
distance_growth |
The rate at which the distances between the circles grow. Only applicable when |
An 'sf' data frame
zb_plot(zb_doughnut(london_c(), london_a()))
zb_plot(zb_doughnut(london_c(), london_a()))
Create lines radiating at equal angles from a point
zb_lines(point, n, starting_angle = 45, distance = 1e+05)
zb_lines(point, n, starting_angle = 45, distance = 1e+05)
point |
Center point |
n |
Number of lines |
starting_angle |
Starting angle |
distance |
Distance |
Objects of class 'sfc' containing linestring geometries
point = sf::st_centroid(london_a()) n = 4 l = zb_lines(point, n) plot(l)
point = sf::st_centroid(london_a()) n = 4 l = zb_lines(point, n) plot(l)
This function opens a static map of the zones
zb_plot( z, palette = c("rings", "hcl", "dartboard"), title = NULL, text_size = c(0.3, 1), zone_label_thres = 0.002 )
zb_plot( z, palette = c("rings", "hcl", "dartboard"), title = NULL, text_size = c(0.3, 1), zone_label_thres = 0.002 )
z |
An 'sf' object containing zones covering the region |
palette |
Palette type, one of |
title |
Plot title |
text_size |
Vector of two numeric values that determine the relative text sizes. The first determines the smallest text size and the second one the largest text size. The largest text size is used for the outermost circle, and the smallest for the central circle in case there are 9 or more circles. If there are less circles, the relative text size is larger (see source code for exact method) |
zone_label_thres |
This number determines in which zones labels are printed, namely each zone for which the relative area size is larger than 'zone_label_thres'. |
A static plot created using R's base 'graphics' package
zb_plot(zb_zone(london_c()))
zb_plot(zb_zone(london_c()))
Divide a region into quadrats
zb_quadrat(x, ncol, nrow = NULL, intersection = TRUE)
zb_quadrat(x, ncol, nrow = NULL, intersection = TRUE)
x |
x |
ncol |
ncol |
nrow |
nrow |
intersection |
intersection |
An sf object
x = london_a() c = sf::st_centroid(london_a()) plot(zb_quadrat(x, ncol = 2), col = 2:5) plot(c, add = TRUE, col = "white") plot(zb_quadrat(x, ncol = 3)) plot(zb_quadrat(x, ncol = 4)) plot(zb_quadrat(x, ncol = 4, intersection = FALSE))
x = london_a() c = sf::st_centroid(london_a()) plot(zb_quadrat(x, ncol = 2), col = 2:5) plot(c, add = TRUE, col = "white") plot(zb_quadrat(x, ncol = 3)) plot(zb_quadrat(x, ncol = 4)) plot(zb_quadrat(x, ncol = 4, intersection = FALSE))
Make segments
zb_segment(x = NULL, area = NULL, n_segments = 12, distance = NA)
zb_segment(x = NULL, area = NULL, n_segments = 12, distance = NA)
x |
Centre point. Should be an |
area |
(optional) Area. Should be an |
n_segments |
(optional) Number of segments. The number of segments. Either one number which determines the number of segments applied to all circles, or a vector with a number for each circle (which should be a multiple of 4, see also the argument |
distance |
Distance The distances between the circles. For the center circle, it is the distance between the center and the circle. If only one number is specified, |
An 'sf' data frame
zb_plot(zb_segment(london_c(), london_a()))
zb_plot(zb_segment(london_c(), london_a()))
This function opens an interactive map of the zones
zb_view(z, alpha = 0.4, palette = c("rings", "hcl", "dartboard"), title = NULL)
zb_view(z, alpha = 0.4, palette = c("rings", "hcl", "dartboard"), title = NULL)
z |
An 'sf' object containing zones covering the region |
alpha |
Alpha transparency, number between 0 (fully transparent) and 1 (not transparent) |
palette |
Palette type, one of |
title |
The title of the plot |
An interactive map created with 'tmap'
z = zb_zone(london_c(), london_a()) zb_view(z, palette = "rings")
z = zb_zone(london_c(), london_a()) zb_view(z, palette = "rings")
This function first divides geographic space into [annuli](https://en.wikipedia.org/wiki/Annulus_(mathematics)) (concentric 2d rings or 'doughnuts') and then subdivides each annulus into a number of segments.
zb_zone( x = NULL, area = NULL, n_circles = NA, n_segments = 12, distance = 1, distance_growth = 1, labeling = NA, starting_angle = NA, segment_center = FALSE, intersection = TRUE, city = NULL )
zb_zone( x = NULL, area = NULL, n_circles = NA, n_segments = 12, distance = 1, distance_growth = 1, labeling = NA, starting_angle = NA, segment_center = FALSE, intersection = TRUE, city = NULL )
x |
Centre point. Should be an |
area |
(optional) Area. Should be an |
n_circles |
Number of rings including the central circle. By default 5, unless |
n_segments |
(optional) Number of segments. The number of segments. Either one number which determines the number of segments applied to all circles, or a vector with a number for each circle (which should be a multiple of 4, see also the argument |
distance |
Distance The distances between the circles. For the center circle, it is the distance between the center and the circle. If only one number is specified, |
distance_growth |
The rate at which the distances between the circles grow. Only applicable when |
labeling |
The labeling of the zones. Either |
starting_angle |
The angle of the first of the radii that create the segments (degrees). By default, it is either 15 when |
segment_center |
Should the central circle be divided into segments? 'FALSE' by default. |
intersection |
Should the zones be intersected with the area? |
city |
(optional) Name of the city. If specified, it adds a column 'city' to the returned 'sf' object. |
By default 12 segments are used for each annuli, resulting in a zoning system that can be used to refer to segments in [clock position](https://en.wikipedia.org/wiki/Clock_position), with 12 representing North, 3 representing East, 6 Sounth and 9 Western segments.
An 'sf' object containing zones covering the region
# default settings z = zb_zone(london_c(), london_a()) zb_plot(z) if (require(tmap)) { zb_view(z) z = zb_zone("Berlin") zb_view(z) } # variations zb_plot(zb_zone(london_c(), london_a(), n_circles = 2)) zb_plot(zb_zone(london_c(), london_a(), n_circles = 4, distance = 2, distance_growth = 0)) zb_plot(zb_zone(london_c(), london_a(), n_circles = 3, n_segments = c(1,4,8)))
# default settings z = zb_zone(london_c(), london_a()) zb_plot(z) if (require(tmap)) { zb_view(z) z = zb_zone("Berlin") zb_view(z) } # variations zb_plot(zb_zone(london_c(), london_a(), n_circles = 2)) zb_plot(zb_zone(london_c(), london_a(), n_circles = 4, distance = 2, distance_growth = 0)) zb_plot(zb_zone(london_c(), london_a(), n_circles = 3, n_segments = c(1,4,8)))