Skip to contents

urban_grid() covers a spatial object with square cells, the unit of observation in the Urban Atlas. The lattice is anchored at whole multiples of the pitch, so grids built for different areas in the same coordinate reference system register with one another.

Usage

urban_grid(x, pitch = 250)

Arguments

x

An sf, sfc, or bbox object in a projected coordinate reference system.

pitch

The side of a cell in metres, or a units::units object. The default, 250 m, is the cell of the original atlas. It is converted to the units of the coordinate reference system of x.

Value

An sf object with one square polygon per cell and the columns cell (an identifier) and x and y (the cell centre). The pitch, in the units of the coordinate reference system, is stored in the "pitch" attribute.

See also

urban_aggregate() to move data onto the cells.

Examples

area <- sf::st_as_sfc(sf::st_bbox(
  c(xmin = 583000, ymin = 4506000, xmax = 585000, ymax = 4507500),
  crs = 32618
))
urban_grid(area)
#> Simple feature collection with 48 features and 3 fields
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 583000 ymin: 4506000 xmax: 585000 ymax: 4507500
#> Projected CRS: WGS 84 / UTM zone 18N
#> First 10 features:
#>    cell      x       y                       geometry
#> 1     1 583125 4506125 POLYGON ((583000 4506000, 5...
#> 2     2 583375 4506125 POLYGON ((583250 4506000, 5...
#> 3     3 583625 4506125 POLYGON ((583500 4506000, 5...
#> 4     4 583875 4506125 POLYGON ((583750 4506000, 5...
#> 5     5 584125 4506125 POLYGON ((584000 4506000, 5...
#> 6     6 584375 4506125 POLYGON ((584250 4506000, 5...
#> 7     7 584625 4506125 POLYGON ((584500 4506000, 5...
#> 8     8 584875 4506125 POLYGON ((584750 4506000, 5...
#> 9     9 583125 4506375 POLYGON ((583000 4506250, 5...
#> 10   10 583375 4506375 POLYGON ((583250 4506250, 5...