fix_ggmap_bbox | R Documentation |
The function is part of a process to fix an issue in ggplot2
where
vector sf
layers and raster ggmap
layers do not align properly.
It renames the bounding box element to the names st_bbox
expects,
converts the bbox to an sf
polygon, transforms it to EPSG:3875, and
then converts back to a bbox.
fix_ggmap_bbox(.map)
.map |
(ggmap) A ggmap object as returned by |
returns the original ggmap object but with a respecified bounding box using EPSG:3857 (WGS84)
## Not run:
actmap <- get_stamenmap(act_bbox, maptype = "toner-lite", zoom = 13)
actmap <- fix_ggmap_bbox(actmap)
map_data <- st_transform(map_data, crs = 3857)
map_data <- mutate(map_data, geometry = st_transform(geometry, crs = 3857))()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.