bbox_to_tile_grid: bbox_to_tile_grid In slippymath: Slippy Map Tile Tools

Description

Bounding box to tile grid

Usage

 `1` ```bbox_to_tile_grid(bbox, zoom = NULL, max_tiles = NULL) ```

Arguments

 `bbox` the bounding box to fit onto a grid of tiles. Must be either a 'bbox' object created with sf::st_bbox or a vector of length 4 with names: 'xmin', 'xmax', 'ymin', 'ymax'. `zoom` Optional. The desired zoom level. `max_tiles` Optional. The maximum number of tiles the grid may occupy.

Details

Calculate a slippy map tile grid that will fit a supplied bounding box.

The grid is returned as part of a tile_grid object that contains a data.frame of x,y tile numbers and zoom level.

The tile grid can be calculated for a given zoom level or for the deepest zoom that ensures the number of tiles is less than or equal to 'max_tiles'.

If 'zoom' and 'max_tiles' are supplied together, then the max is still enforced and the function will fail if more tiles are required for the given zoom.

Value

a 'tile_grid' object containing 'tiles' and 'zoom'

Examples

 ```1 2 3 4 5 6 7 8``` ```tibrogargan<- c(xmin = 152.938485, ymin = -26.93345, xmax = 152.956467, ymax = -26.921463) ## Get a grid of the minimum number of tiles for a given zoom. bbox_to_tile_grid(tibrogargan, zoom = 15) ## get a grid of at most 12 tiles, choosing the most detailed zoom possible. bbox_to_tile_grid(tibrogargan, max_tiles = 12) ```

Example output

```\$tiles
x     y
1 30304 18929
2 30305 18929
3 30306 18929
4 30304 18930
5 30305 18930
6 30306 18930
7 30304 18931
8 30305 18931
9 30306 18931

\$zoom
[1] 15

attr(,"class")
[1] "tile_grid"
\$tiles
x     y
1 30304 18929
2 30305 18929
3 30306 18929
4 30304 18930
5 30305 18930
6 30306 18930
7 30304 18931
8 30305 18931
9 30306 18931

\$zoom
[1] 15

attr(,"class")
[1] "tile_grid"
```

slippymath documentation built on June 28, 2019, 5:04 p.m.