ubc-geomatics-textbook/geomatics-textbook

Leaflet for Fort St. John TSA?

Closed this issue · 3 comments

in 09-raster-analysis-terrain-modelling.Rmd starting on line 416 there's a leaflet for the Fort St. John study area, but it doesn't appear in the textbook from what I can tell. Should it??

{r map, echo=FALSE, include=FALSE}
ROI_2 <- st_read("data/09/FSJTSA.shp")
m = leaflet() %>%
  addProviderTiles("Esri.WorldImagery") %>% #http://leaflet-extras.github.io/leaflet-providers/preview/
  addScaleBar(position = c("topleft")) %>%
  addFeatures(ROI_2, group = "Fort St. John TSA", fill = FALSE)%>%
  addLayersControl(overlayGroups = c("Fort St. John TSA"), position = c("bottomleft"), options = layersControlOptions(collapsed = TRUE))

If so, then it will need to have a static image created as well as a new caption that will build with LaTex and web output.

Yes, just add m to the last line of the next code chunk that has the fig_cap to call the map:

if (knitr:::is_latex_output()) { 
  fig_cap <- paste0("The Fort St. John Timber Supply Area, British Columbia, Canada. Data from Government of British Columbia and licensed under the Open Government Licence - British Columbia. Mesler, CC-BY-SA-4.0. Interactive figure can be viewed in the web browser version of the textbook: https://ubc-geomatics-textbook.github.io/geomatics-textbook/raster-analysis-and-terrain-modelling.html")
  knitr::include_graphics("images/09-fort-st-join-study-area-leaflet.png")
} else { 
  fig_cap <- paste0("The Fort St. John Timber Supply Area, British Columbia, Canada. Data from Government of British Columbia and licensed under the Open Government Licence - British Columbia. Mesler, CC-BY-SA-4.0.")
  m
}

Edited to add the if/else statement. Need to also create 09-fort-st-join-study-area-leaflet.png static image of the leaflet.

I also would suggest renaming this code chunk from the current generic map to 09-fort-st-john-study-area-map to avoid throwing warnings on output with other chunks that might also be named map.

Created the image and added the captions for each output.