dotmap_project: Create dotmap project

View source: R/dotmap_data.R

dotmap_projectR Documentation

Create dotmap project

Description

This function creates a dotmap project.

Usage

dotmap_project(dir, area1 = NULL, area2 = NULL, region = NULL, vars,
  var_titles = NULL, var_labels = NULL, pop_totals = NULL,
  pop_tables, dens_ub = NULL, dens_lb = NULL, bbx = NA, z,
  z_arr = NA, scale = NA, tile_size = 256, transparent = TRUE,
  settings, title = "Dotmap", region_title = "Borders",
  labels_title = "Labels", dots_text = "", dotmap_attr = "")

Arguments

dir

The project directory. It has/will have the following subdirectories: source (raw input files), input (preprocessed input files), tiles_area (processed data regarding the canvas available for the dots), dotmap_data (processed data regarding the dotmap), htmlserver (the output tile server), website (the dotmap website).

area1

A spatial polygons object (class sfc or sf) that defines main the canvas for the dots. For instance, the OSM land use category residential.

area2

(optional) A spatial polygons object (class sfc or sf) that defines second-stage canvas for the dots. Only used if not all dots can be placed on the main canvas (defined by area1).

region

A spatial polygons object (class sfc or sf) that defines the regions of the dots. The data (see pop_totals and pop_tables) should be provided per region. Note that region can be specified by the same spatial object as area1, but not necessarily. For instance, region could be the municiaplity borders, while area1 are residential areas.

vars

Character vector that specifies the variables. These names are used within the process, so please do no use whitespaces.

var_titles

Character vector that specifies the variable titles (shown in the visualization).

var_labels

List of category labels per variable. So each list item corresponds to a variable and should be a vector of category labels.

pop_totals

Either a number vector that contains the population sizes per region, or a data.frame with a column pop (with population numbers) and optionally a column class which defines the dot density class (see dens_ub and dens_lb)

pop_tables

pop_tables For each variable, a data.frame where the rows correspond to the regions and the columns to the categories.

dens_ub

Upper bound for the dot densities per class (see also pop_totals). If the number of dots exceeds this number, the remaining dots will be placed in the area2 region if defined. Otherwise, they are ignored.

dens_lb

dens_lb Lower bound for the dot densities per class. If the number of dots is lower than this number, they are not drawn.

bbx

Bounding box. By default, the bounding box of region is taken.

z

List of zoom levels at which the dots are distributed and drawn. Each list item corresponds a distribution level. If only one distribution level is specified, the dots are distributed at a specific zoom level, where for other zoom levels, they are blended to darker pixel colors (zooming out) or enlarged (zooming in). If multiple zoom levels are specified, the dots are distributed at the highest zoom level, and after that aggregated to super dots for the other distribution levels. For each list item, a numeric vector of three should be specified: the zoom level at which the dots are distributed, the lowest zoom level at which this distribution is rendered, the highest zoom level at which this distribution is rendered. Note that the distribution zoom level does not have to be the same as one of the other two zoom levels. However, across all distribution levels, all zoom levels have to be present. The order of list items should be increasing, so the first vector should specify the distribution level of the lowest zoom level.

z_arr

The zoom level at which the tiles are first created. If set to the highest distribution zoom level (see z), the tiles will be as large as tile_size. By default, they are two zoom levels lower (so the tiles are 4x4 as large).

scale

Vector of numbers that specify how many small dots a super dot represents. Only applicable if z contains more than 1 list items. If so, it should be the same length of z, where the last value should be 1 (since it represents the small dots). By default, it is 4 for one zoom level difference, 16 for two zoom levels difference, etc.

tile_size

Tile size. By default 256

transparent

Should the tiles be transparent? By default TRUE

settings

A list, with per variable, a list of color settings.

title

Title of the dotmap

region_title

Title of the region boundary layer.

labels_title

Title of the map labels layer.

dots_text

dots_text Text that explains the dots in the legend (e.g. "one dot represents one person"). When multiple distribution levels are used, it should be a vector.

dotmap_attr

dotmap_attr The map attribute for the dotmap layer.


mtennekes/dotmap documentation built on Aug. 24, 2023, 3:40 a.m.