pspnet2 <- st_read("D:/Dropbox (GaTech)/Work/Working/GSV_walkability/Shiny/publish/pspnet_4git.geojson") %>% 
  mutate(b2s = (p.building + p.house)/(p.sidewalk + p.road + p.car),
         green = p.tree + p.plant + p.grass,
         s2s = p.sidewalk/(p.sidewalk + p.road + p.car))
## Reading layer `pspnet_4git' from data source 
##   `D:\Dropbox (GaTech)\Work\Working\GSV_walkability\Shiny\publish\pspnet_4git.geojson' 
##   using driver `GeoJSON'
## Simple feature collection with 18395 features and 11 fields
## Geometry type: LINESTRING
## Dimension:     XY
## Bounding box:  xmin: -84.56574 ymin: 33.63284 xmax: -84.28599 ymax: 33.9021
## Geodetic CRS:  NAD83
draw_map <- function(var, FUN = colorNumeric){
  pal <- FUN(palette = "Reds", domain = pspnet2[[var]])

  leaflet() %>% 
    addProviderTiles(providers$CartoDB.DarkMatterNoLabels) %>% 
    addPolylines(data = pspnet2, color = ~pal(pspnet2[[var]]), weight = 2) %>% 
    addLegend(position="bottomright", pal = pal, values = pspnet2[[var]], title = paste0("% ", substr(var,3,nchar(var))))
}

% Building

draw_map("p.building",colorQuantile)
## Warning: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs).
## Need '+proj=longlat +datum=WGS84'

Sidewalk

draw_map("p.sidewalk", FUN = colorQuantile)
## Warning: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs).
## Need '+proj=longlat +datum=WGS84'

Sky

draw_map("p.sky", colorQuantile)
## Warning: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs).
## Need '+proj=longlat +datum=WGS84'

Tree

draw_map("p.tree", colorQuantile)
## Warning: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs).
## Need '+proj=longlat +datum=WGS84'

Building-to-street ratio

draw_map("b2s", colorQuantile)
## Warning: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs).
## Need '+proj=longlat +datum=WGS84'

Green

draw_map("green", colorQuantile)
## Warning: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs).
## Need '+proj=longlat +datum=WGS84'

Sidewalk-to-street proportion

draw_map("s2s", colorQuantile)
## Warning: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs).
## Need '+proj=longlat +datum=WGS84'