Reputation: 53
I am using the mapboxapi package in R to save static aerial images
I want to see the outline of the polygon on a static image, with the fill being entirely transparent. Setting overlay_style$fill-opacity to 0 is not working. What am I doing wrong?
#make a polygon showing area you want to view in MapBox
lon = c(-128.6816, -128.6812)
lat = c(54.65256, 54.65292)
poly_coord_df = data.frame(lon, lat)
poly = poly_coord_df %>%
st_as_sf(coords = c("lon", "lat"), crs = 32611) %>%
st_bbox() %>%
st_as_sfc()
#make a list with desired overlay_style
o_style = list()
o_style$'stroke' = '#ff3300'
o_style$'fill' = '#ff3300 '
o_style$'fill-opacity' = 0 #setting fill-opacity to 0 is not working
#make the map
map = static_mapbox(
style_id = 'satellite-v9',
username = "mapbox",
overlay_sf = poly,
overlay_style = o_style,
width = 1000,
height = 800
)
map
Upvotes: 1
Views: 121