Skip to contents

The plates of the Urban Atlas are square panels of 80 by 80 cells, each covering 20 km at a scale of 1:48,000, so that every city is seen at the same size. urban_panel() makes the extent of such a panel, snapped to the lattice. coord_urban() sets a plot to that extent, and urban_panel_size() gives the size at which to save the plot so that the panel is at true scale.

Usage

urban_panel(
  x,
  y,
  cells = 80,
  pitch = 250,
  crs = 2263,
  anchor = c("southwest", "centre")
)

coord_urban(panel = NULL, ...)

urban_panel_size(
  panel,
  scale = 48000,
  margin = c(0, 0),
  units = c("in", "cm", "mm")
)

Arguments

x, y

A corner or the centre of the panel, in the units of crs.

cells

The number of cells along each side of the panel.

pitch

The side of a cell in metres, or a units::units object.

crs

The coordinate reference system. The default, EPSG:2263, is the state plane system used for New York City.

anchor

Whether x and y give the "southwest" corner or the "centre" of the panel.

panel

A panel made by urban_panel(), or any bbox, sf, or sfc object. For coord_urban() the default, NULL, gives a Cartesian coordinate system instead, for charts.

...

Other arguments passed on to ggplot2::coord_sf(), or to ggplot2::coord_cartesian() when panel is NULL.

scale

The denominator of the map scale. The default is the 1:48,000 of the original atlas.

margin

Extra width and height for margins, legend, and caption, in the units of the result.

units

The units of the result: "in", "cm", or "mm".

Value

urban_panel() returns a bbox object, with the pitch in the units of crs in its "pitch" attribute.

coord_urban() returns a ggplot2 coordinate system. It is also what prints a layer over those beneath it when the layer has overprint = TRUE; see geom_urban_disc().

urban_panel_size() returns a named numeric vector, width and height, suitable for ggplot2::ggsave().

Examples

west <- urban_panel(963000, 172000)
west
#>      xmin      ymin      xmax      ymax 
#>  962924.6  172243.8 1028541.3  237860.4 
#> attr(,"pitch")
#> [1] 820.2083

# The neighbouring panel to the east shares an edge.
east <- urban_panel(west[["xmax"]], west[["ymin"]])

urban_panel_size(west)
#>   width  height 
#> 16.4042 16.4042