Usage Arguments Author(s) Examples
1 | MakeMap(EcologicalSiteId, TDat_LMF, EcoSitePlots)
|
EcologicalSiteId |
Full ecological site id, list of ecological sites, or object |
TDat_LMF |
Combined TerrADat and LMF dataframe (returned object from Combine_AIM_LMF function) |
EcoSitePlots |
Combined TerrADat and LMF dataframe, subset to your ecological site. Returned object from consecutive Combine_AIM_LMF and SubsetEcologicalSite functions. |
Rachel Burke, ecologist/analyst @ Jornada
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | EcologicalSiteId <- c("R042XB012NM", "R042XB015NM")
MakeMap(EcologicalSiteId = EcologicalSiteId, TDat_LMF = TDat_LMF, EcoSitePlots = EcoSitePlots)
## The function is currently defined as
function(EcologicalSiteId, TDat_LMF, EcoSitePlots){
##Caption to use in your tables and plots
Caption <- paste0("Cover Summaries for Ecological Site" , EcologicalSiteId)
#Clean up
TDat_LMF <- TDat_LMF
dplyr::arrange(EcologicalSiteId)
dplyr::filter(Latitude_NAD83 > 0)
# List of ecological sites for legend
EcoSiteList <- unique(TDat_LMF$EcologicalSiteId)
#Set color palettes
Pal_EcoSite <- leaflet::colorFactor(palette = 'YlOrRd' , domain = TDat_LMF$es_name)
Pal_Date <- leaflet::colorFactor(palette = 'Greys' , domain = TDat_LMF$Year)
Pal_EcoSiteID <- leaflet::colorFactor(palette = "Red" , domain = EcologicalSiteId)
EcoSite_All <- TDat_LMF$es_name
Year <- TDat_LMF$Year
Map <- leaflet::leaflet(height = 650 , width = 650)
#Convert vector to string to use in caption
EcoSiteCaption <- toString(EcologicalSiteId)
Map <- leaflet::addTiles(Map)
popup = paste("Ecological Site: " , TDat_LMF$es_name,
"Ecolgical Site Id: " , TDat_LMF$EcologicalSiteId,
sep = "<br>") ,
color = ~Pal_Date(Year) ,
fillOpacity = .5 , group = Year ,
data = TDat_LMF)
leaflet::addCircleMarkers(lng = ~Longitude_NAD83 , lat = ~Latitude_NAD83 ,
radius = 3 ,
fillOpacity = 0.5 ,
popup = paste("Ecological Site: " ,EcoSitePlots$es_name ,
"Ecological Site Id: " , EcoSitePlots$EcologicalSiteId ,
sep = "<br>") ,
color = "red" , group = EcologicalSiteId ,
data = EcoSitePlots)
leaflet::addLayersControl(overlayGroups = c(EcologicalSiteId , Year) ,
options = leaflet::layersControlOptions(collapsed = TRUE))
leaflet::addLegend(pal = Pal_Date , values = TDat_LMF$Year , opacity = 1 , group = Year)
leaflet::addLegend(pal = Pal_EcoSiteID , values = EcologicalSiteId , opacity = 1 , group = EcologicalSiteId)
return(Map)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.