Title: | Make Multiple 'leaflet' Maps in 'Shiny' |
---|---|
Description: | Simplify creating multiple, related 'leaflet' maps across tabs for a 'shiny' application. Users build lists of any polygons, points, and polylines needed for the project, use the map_server() function to assign built lists and other chosen aesthetics into each tab, and the package leverages modules to generate all map tabs. |
Authors: | Rachel Greenlee [aut, cre, cph], Zachary Palmore [aut], Jason Bryer [ctb], Angela Lui [ctb] |
Maintainer: | Rachel Greenlee <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.0 |
Built: | 2024-10-10 03:28:53 UTC |
Source: | https://github.com/rachel-greenlee/atlasmaker |
Derived from data.ny.gov biodiversity data by county, filtered for amphibians only and combined with counties_NY Census-sourced data.
A spatial data frame with 62 county entries:
state's code
county name
latitude
longitude
area of land, in square meters
area of water, in square meters
For animals and plants, the taxonomic phylum, class, or order to which the species belongs.
count of species from amphibians taxonomic grouped by county
...
https://data.ny.gov/Energy-Environment/Biodiversity-by-County-Distribution-of-Animals-Pla/tk82-7km5
Derived from data.ny.gov biodiversity data by county, filtered for birds only.
A spatial data frame with 62 county entries:
state's code
county name
latitude
longitude
area of land, in square meters
area of water, in square meters
For animals and plants, the taxonomic phylum, class, or order to which the species belongs.
count of species from birds taxonomic group by county
...
https://data.ny.gov/Energy-Environment/Biodiversity-by-County-Distribution-of-Animals-Pla/tk82-7km5
US Census polygon data for New York state counties accessed through the tigris
R Package.
A spatial data frame with 62 rows and 7 variables:
state's code
county name
latitude
longitude
area of land, in square meters
area of water, in square meters
polygon information
...
https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html
Derived from data.ny.gov biodiversity data by county, filtered for flowering plants only.
A spatial data frame with 62 county entries:
state's code
county name
latitude
longitude
area of land, in square meters
area of water, in square meters
For animals and plants, the taxonomic phylum, class, or order to which the species belongs.
count of species from flowering plants taxonomic group by county
...
https://data.ny.gov/Energy-Environment/Biodiversity-by-County-Distribution-of-Animals-Pla/tk82-7km5
This is the core ui and server function for AtlasMaker where users pass in the spatial-data based lists and aesthetic choices for each map tab.
map_server( id, polygons = NULL, polygon_legend_title = NULL, points = NULL, polylines = NULL, center = NULL, min_zoom = 7, map_base_theme = "Stamen.Terrain", poly_palette = "BuPu", point_color = "black", polyline_color = "gray" )
map_server( id, polygons = NULL, polygon_legend_title = NULL, points = NULL, polylines = NULL, center = NULL, min_zoom = 7, map_base_theme = "Stamen.Terrain", poly_palette = "BuPu", point_color = "black", polyline_color = "gray" )
id |
identifier for the map. This must match the id used in |
polygons |
polygon data in geospatial format. |
polygon_legend_title |
title to display on legend for polygon shading |
points |
point data with label, lat, and long variables. |
polylines |
polyline data in geospatial format. |
center |
lat/long of where to center the default map. |
min_zoom |
minimum zoom level users can see, default 7. |
map_base_theme |
Leaflet-compatible theme for base map. |
poly_palette |
Leaflet-compatible color palette for polygon shading. |
point_color |
Leaflet-compatible single color for point colors. |
polyline_color |
Leaflet-compatible single color for polyline colors. |
a list of parameters, including spatial data, that are passed into the AtlasMaker module that builds a single map tab.
server <- function(input, output) { map_server(id = map2, polygons = watersheds, polygon_legend_title = "Watershed", points = farms, polylines = rivers, point_color = 'red', polyline_color = 'black') }
server <- function(input, output) { map_server(id = map2, polygons = watersheds, polygon_legend_title = "Watershed", points = farms, polylines = rivers, point_color = 'red', polyline_color = 'black') }
This is the core ui function for AtlasMaker.
map_UI(id)
map_UI(id)
id |
identifier for the map. This must match the id used in |
a leaflet::leafletOutput()
object.
map_UI('flowering_plants') map_UI('map1') map_UI('map2')
map_UI('flowering_plants') map_UI('map1') map_UI('map2')
Takes user defined data for points in demo1 Default is NULL or empty
A function with arguments x, ...:
user data
...
Data on campgrounds in and outside of the Adirondacks in New York. For this package demo two data files were combined and only three columns were retained.
A data frame with 116 rows and 3 variables:
name of the campground
longitude value
latitude value
...
https://data.ny.gov/Recreation/Campgrounds-by-County-Within-Adirondack-Catskill-F/tnqf-vydw
https://data.ny.gov/Recreation/Campgrounds-by-County-Outside-Adirondack-Catskill-/5zxz-z3ci
Data on state parks in New York. For this package demo only three columns were retained.
A data frame with 254 rows and 3 variables:
name of state park
longitude value
latitude value
...
https://data.ny.gov/Recreation/Watchable-Wildlife-Sites/hg7a-5ssi
Data originally from data.ny.gov, for this package demo only three columns were retained.
A data frame with 76 rows and 3 variables:
name of watchsite location
longitude value
latitude value
...
https://data.ny.gov/Recreation/Watchable-Wildlife-Sites/hg7a-5ssi
Derived from data.ny.gov biodiversity data by county, filtered for reptiles only.
A spatial data frame with 62 county entries:
state's code
county name
latitude
longitude
area of land, in square meters
area of water, in square meters
For animals and plants, the taxonomic phylum, class, or order to which the species belongs.
count of species from reptiles taxonomic group by county
...
https://data.ny.gov/Energy-Environment/Biodiversity-by-County-Distribution-of-Animals-Pla/tk82-7km5
US Census polyline data for New York state interstates accessed through the tigris
R Package.
A data frame with 245 rows and 5 variables:
unique identifier
interstate name
route type
US Census feature class code
polyline information
...
Run a the AtlasMaker Shiny Demo
shiny_AtlasMaker(app = c("demo1"))
shiny_AtlasMaker(app = c("demo1"))
app |
defaults to demo1 |
Demo of AtlasMaker, a Shiny app that displays 4 tabs of Leaflet maps. See package vignette for code.