Generate a spatial data frame of BNG references and grid square geometries.
Usage
bng_grid_100km(xmin, ymin, xmax, ymax, ...)
bng_grid_50km(xmin, ymin, xmax, ymax, ...)
bng_grid_10km(xmin, ymin, xmax, ymax, ...)
bng_grid_5km(xmin, ymin, xmax, ymax, ...)
bng_grid_1km(xmin, ymin, xmax, ymax, ...)
Arguments
- xmin, ymin, xmax, ymax
Optional bounding box coordinates.
- ...
Additional arguments. Not currently used.
Value
Data frame object of type sf
with the grid reference as a
BNGReference
object and the grid square polygon geometry.
Details
These convenience functions generate a spatial data frame of BNG references
and grid square geometries at pre-determined resolutions. This function
combines bbox_to_bng()
and bng_to_grid_geom()
into a data
frame. Optionally, the grid can be for a defined bounding box area of
interest. If the bounding box is omitted, then all grid squares within the
valid bounds of the BNG are returned.
Only selected resolutions are provided to avoid excessively large data
frames. For additional spatial data files of all resolutions, please see the
osbng-grids
GitHub repo.
The sf
package is required for this function.
Examples
bng_grid_100km()
#> Simple feature collection with 91 features and 1 field
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 0 ymin: 0 xmax: 7e+05 ymax: 1300000
#> Projected CRS: OSGB 1936 / British National Grid
#> First 10 features:
#> bng_reference geometry
#> 1 <SV> POLYGON ((0 0, 1e+05 0, 1e+...
#> 2 <SW> POLYGON ((1e+05 0, 2e+05 0,...
#> 3 <SX> POLYGON ((2e+05 0, 3e+05 0,...
#> 4 <SY> POLYGON ((3e+05 0, 4e+05 0,...
#> 5 <SZ> POLYGON ((4e+05 0, 5e+05 0,...
#> 6 <TV> POLYGON ((5e+05 0, 6e+05 0,...
#> 7 <TW> POLYGON ((6e+05 0, 7e+05 0,...
#> 8 <SQ> POLYGON ((0 1e+05, 1e+05 1e...
#> 9 <SR> POLYGON ((1e+05 1e+05, 2e+0...
#> 10 <SS> POLYGON ((2e+05 1e+05, 3e+0...
bng_grid_1km(529476, 179654, 532170, 181116)
#> Simple feature collection with 12 features and 1 field
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 529000 ymin: 179000 xmax: 533000 ymax: 182000
#> Projected CRS: OSGB 1936 / British National Grid
#> First 10 features:
#> bng_reference geometry
#> 1 <TQ 29 79> POLYGON ((529000 179000, 53...
#> 2 <TQ 30 79> POLYGON ((530000 179000, 53...
#> 3 <TQ 31 79> POLYGON ((531000 179000, 53...
#> 4 <TQ 32 79> POLYGON ((532000 179000, 53...
#> 5 <TQ 29 80> POLYGON ((529000 180000, 53...
#> 6 <TQ 30 80> POLYGON ((530000 180000, 53...
#> 7 <TQ 31 80> POLYGON ((531000 180000, 53...
#> 8 <TQ 32 80> POLYGON ((532000 180000, 53...
#> 9 <TQ 29 81> POLYGON ((529000 181000, 53...
#> 10 <TQ 30 81> POLYGON ((530000 181000, 53...