Skip to content

Commit

Permalink
html smoothed map with street names
Browse files Browse the repository at this point in the history
  • Loading branch information
amd112 committed Feb 5, 2025
1 parent 2ed7f97 commit d701d19
Show file tree
Hide file tree
Showing 21 changed files with 22,014 additions and 1 deletion.
25 changes: 24 additions & 1 deletion code/02_mapping_2020_2022_raster.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ addLegend_decreasing <- function (map, position = c("topright", "bottomright", "
# load data
################################################################################

nyc = st_read("https://data.cityofnewyork.us/api/geospatial/tqmj-j8zm?method=export&format=GeoJSON") %>%
nyc = st_read("https://data.cityofnewyork.us/api/geospatial/jgqm-ccbd?method=export&format=GeoJSON") %>%
st_transform("+proj=longlat +datum=WGS84")

mean_temp = raster('data/input/surfacetemperature_mean_2020_2022.tif')
Expand Down Expand Up @@ -227,3 +227,26 @@ mapshot(map,
remove_controls = c("homeButton", "layersControl"), vwidth = 1000, vheight = 850)


################################################################################
# custom smoothed plot - 1.5 block average
################################################################################


map = leaflet(options = leafletOptions(zoomControl = FALSE,
minZoom = 11,
maxZoom = 18)) %>%
addProviderTiles('CartoDB.PositronNoLabels',
options = providerTileOptions(minZoom = 11, maxZoom = 18)) %>%
addRasterImage(deviation_smooth, colors = heat_pal, opacity = 0.3) %>%
addLegend_decreasing(position = "topleft",
pal = heat_pal,
values = values(deviation_smooth),
title = paste0("Temperature Deviation", "<br>", "from Mean"),
labels = c("> 8°", "", "", "", "", "-2°",
"-4°", "-6°", "< -8°"),
decreasing = T) %>%
addProviderTiles('CartoDB.PositronOnlyLabels', #'Stadia.StamenTonerLabels'/'CartoDB.PositronOnlyLabels'
options = providerTileOptions(minNativeZoom=15))

saveWidget(map, file=file.path('visuals',
"custom_street_names_summer_heat_smoothed_deviation_raster.html"))
Loading

0 comments on commit d701d19

Please sign in to comment.