Nearest neighbours spatial thinning of polygonal grids

st_thin(x, lag)

Arguments

x

an sf data.frame.

lag

lag order.

Value

a thinned sf::st_as_sf() object.

Note

This function is still under development.

References

Based on SO answer: https://stackoverflow.com/questions/65907022/

Examples

# \dontrun{ require(rangeMapper) con = rmap_connect() wrens = read_wrens() rmap_add_ranges(con, x = wrens, ID = 'sci_name') rmap_prepare(con, 'hex', cellsize=500)
#> --> Making hex canvas ...
#> done.
#> (i) The canvas has 576 cells.
#> --> Processing 84 ranges ...
#> --> Updating rmap_nfo & rmap_master tables ...
#> done.
#> (i) Finished in 0.152s elapsed (0.125s cpu)
rmap_save_map(con) x = rmap_to_sf(con)[, 'cell_id'] plot( st_thin(x,2) )
x = x[ ! x$cell_id %in% c(282,265) , ] plot( st_thin(x,3) )
# }