View source: R/General_Functions.R
bbox_at_zoom | R Documentation |
This function returns a bounding box with a constant aspect ratio. By default the zoom leve is fit to the input spatial file or the zoom level can be defined by the user and centered on the center value of the input.
bbox_at_zoom(locs, zoom_level = NULL)
locs |
An sf or sp object. The bounding box will be centered on the mid point value of bound box of this object. |
zoom_level |
Numeric. Specifies how zoomed in the bounding box should be, eg. 1 = whole world and 4 = 1/4 of world. Defaults to NULL, which will calculate the zoom level required to contain locs |
an object with class "bbox" containing four values: xmin, ymin, xmax, and ymax. Values will be in units of locs (either decimal degrees or meters).
Code adapted from: https://www.r-bloggers.com/2019/04/zooming-in-on-maps-with-sf-and-ggplot2/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.