Skip to contents

delineate_settlements() lays a grid over building points, marks the cells holding at least one building as settled, and joins settled cells that touch into settlement patches. The patches feed the zones of build_blocks() and the patch of unit_graph(), which keeps a village in one group when it fits under the caps.

Usage

delineate_settlements(points, cell = 100, link = 1L)

Arguments

points

Buildings, as an sf or sfc object of points or of footprint polygons (their centroids are used). The grid is laid in their CRS, so points in longitude and latitude with cell = 3 / 3600 give the 3 arc-second grid of the WorldPop rasters. Transform the patches to the projected CRS of the blocks afterwards.

cell

The side of a grid cell, in CRS units. The default 100 suits a metric CRS and matches the 100 m size of the WorldPop rasters.

How far apart, in cells, two settled cells may be and still belong to one settlement. The default 1 joins cells that touch at a side or a corner. 2 also joins cells with one empty cell between them, which merges hamlets that are one field apart.

Value

An sf object with one row per patch, holding settlement (its id), buildings and cells. The cell size is kept in the attribute "cell", which build_blocks() uses to space the points of its zones.

Examples

set.seed(1)
village <- cbind(rnorm(80, 300, 60), rnorm(80, 300, 60))
hamlet <- cbind(rnorm(15, 900, 30), rnorm(15, 700, 30))
houses <- sf::st_sfc(
  lapply(seq_len(95), function(i) {
    sf::st_point(rbind(village, hamlet)[i, ])
  }),
  crs = 32630
)
delineate_settlements(houses, cell = 100)
#> Simple feature collection with 2 features and 3 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 100 ymin: 100 xmax: 1000 ymax: 800
#> Projected CRS: WGS 84 / UTM zone 30N
#>   settlement buildings cells                       geometry
#> 1          1        80    10 MULTIPOLYGON (((200 200, 20...
#> 2          2        15     4 MULTIPOLYGON (((1000 600, 9...
delineate_settlements(houses, cell = 100, link = 3)
#> Simple feature collection with 2 features and 3 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 100 ymin: 100 xmax: 1000 ymax: 800
#> Projected CRS: WGS 84 / UTM zone 30N
#>   settlement buildings cells                       geometry
#> 1          1        80    10 MULTIPOLYGON (((200 200, 20...
#> 2          2        15     4 MULTIPOLYGON (((1000 600, 9...