#TidyTuesday - 7.22 NYC Art Map

Author

Mikayla Arciaga

NYC Subway Art Map

Map

#only use -------- to denote new column (don't include for input without input column)

renderLeaflet({
  
#color palette for stations/routes
  pal2 <- colorFactor(viridis(24), subway_sf$route_long)            #color palette for routes


#Create u-sub for information shown on station click:
click_details <- paste0(  "<b> Station: </b>", stations_with_art$Stop.Name, "<br>",
                            "<div style='max-height:250px; overflow-y:auto;'>",
                              stations_with_art$full_pop, 
                              "</div>")

#Map Setup
MTA_map <- leaflet(stations_with_art) %>%               
  addProviderTiles(providers$CartoDB.Positron) %>%
  setView(lng = -73.95, lat = 40.75, zoom = 10) %>%     #NYC Base Coords
  addPolylines(data = subway_sf,                 #add subway line data (always pull in pipe)
               color = ~pal2(route_long),               #subway line palette
               weight = 3
               ) %>%
  addCircles(data = stations_with_art,                    #Add station points    
           radius = 50,
           fillColor = stations_with_art$Line,
           fillOpacity = 0.8,
           popup = click_details,
           layerId = ~paste0(Stop.Name,"-",Line),
           
)
  
})