Location of Amazon Warehouses in California (work in progress)
library(nominatimlite)
amazon <- read.csv("~/UCSD-Scripps/R Files 2022/Warehouse EJ/amazon.csv")
Geocode Addresses
library(sf)
latlon <- geo_lite_sf(amazon$address.zip, full_results = TRUE, limit = 1, return_addresses = TRUE)
amazon_latlon <- st_as_sf(cbind(amazon, latlon))
Map Locations
library(tidyverse)
library(leaflet)
pal <- colorFactor(
palette = "Spectral",
domain = amazon_latlon$Year)
amazon_latlon %>%
leaflet(width = "100%") %>%
addProviderTiles(providers$Esri.WorldImagery, group = "World Imagery") %>%
addProviderTiles(providers$Stamen.TonerLite, group = "Toner Lite") %>%
addLayersControl(baseGroups = c("Toner Lite", "World Imagery")) %>%
addCircleMarkers(label = ~address.zip,
color = ~pal(Year),
#fillColor = "goldenrod",
fillOpacity = 0.8,
stroke = F) %>%
addLegend("bottomleft", pal = pal, values = ~Year,
title = "Amazon Warehouses </br> Year Opened/Planned",
opacity = 1 ) %>%
setView(lng = -117.5, lat = 33.9, zoom = 8)
Data contains 17 rows with either missing or invalid lat/lon values and will be ignoredn too large, allowed maximum for palette Spectral is 11
Returning the palette you asked for with that many colors
n too large, allowed maximum for palette Spectral is 11
Returning the palette you asked for with that many colors
n too large, allowed maximum for palette Spectral is 11
Returning the palette you asked for with that many colors