Suppose I have the following shapefile:
library(sf)
library(leaflet)
library(leafgl)
library(colourvalues)
library(leaflet.extras)
nc <- st_read(system.file("gpkg/nc.gpkg", package="sf"), quiet = TRUE) %>%
st_transform(st_crs(4326)) %>%
st_cast('POLYGON')
# code for plot/visualization - works
leaflet(data = nc) %>% addPolygons( stroke = FALSE) %>% addTiles(group = "OSM") %>% addProviderTiles(provider = providers$OpenStreetMap) %>% addPolygons(data = nc, weight=1, popup = ~NAME,
label = ~NAME, group = "name", col = 'blue') %>%
addSearchFeatures(targetGroups = 'name', options = searchFeaturesOptions(zoom=10, openPopup=TRUE))
My Question: Within leaflet, is it possible to only load a "part" of this map?
For example, suppose I only want to load the USA - is it possible to do this?
I know that there are ways around this - for example, I could try and configure the zoom to a specific long/lat and then "lock" the map.... but is there a way to only load a select part of the map within leaflet?