Skip to content

Instantly share code, notes, and snippets.

View walkerke's full-sized avatar

Kyle Walker walkerke

View GitHub Profile
# Day 27: Boundaries - World Time Zones
# Shows current time in each timezone, centered on user's location
library(mapgl)
library(sf)
library(dplyr)
library(lubridate)
# Get user's current timezone and time
user_tz <- Sys.timezone()
# Day 26: Transport - US Electric Power Transmission Lines
# Visualizing America's invisible highway: 700,000+ miles of power lines
# Dynamic line widths by voltage class, glowing effect for the energy flow
library(mapgl)
library(sf)
library(dplyr)
# Load transmission lines from HIFLD (Homeland Infrastructure Foundation-Level Data)
# This is a large dataset - we'll use direct URL for the GeoJSON
# Day 25: Hexagons - US Wind Energy Infrastructure
# Multi-resolution H3 hexagonal aggregation of 76,000+ wind turbines
# Aggregating total installed capacity (MW) per hexagon
# Points fade in at high zoom for individual turbine exploration
library(mapgl)
library(h3o)
library(sf)
library(dplyr)
library(readr)
library(shiny)
library(mapgl)
library(tidycensus)
library(sf)
# Get data: median household income by tract in Colorado
co_income <- get_acs(
geography = "tract",
variables = "B19013_001",
state = "CO",
# remotes::install_github("walkerke/mapgl")
library(mapgl)
# CYBERPUNK 2125 - Ultra-striking neon palette
# Deep blacks + electric neons for that Blade Runner / Akira vibe
cyberpunk_2125 <- c(
"#000000", # Pure black (shadows)
"#0a0e27", # Deep space blue (dark areas)
"#1a1a2e", # Dark navy (buildings)
"#16213e", # Midnight blue
library(mapgl)
library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf"))
# Custom style with background-pattern
style <- list(
version = 8,
sources = structure(list(), .Names = character(0)),
layers = list(
library(tidycensus)
library(mapgl)
tx_income <- get_acs(
geography = "tract",
variables = "B19013_001",
state = "TX",
geometry = TRUE
)
library(mapgl)
library(shiny)
library(geojsonsf)
ui <- fluidPage(
tags$head(
tags$style(HTML(
"
body { margin: 0; padding: 0; }
.container-fluid { padding: 0 !important; margin: 0 !important; }
# DuckDB Vector Tiles with mapgl Example
# This script demonstrates how to serve vector tiles from DuckDB using ST_AsMVT()
# and display them in a mapgl map using httpuv
library(mapgl)
library(duckdb) # Requires the latest DuckDB version (>= 1.4.0)
library(httpuv)
library(sf)
library(duckspatial)
library(tigris)
library(mapgl)
library(tidycensus)
tarrant_age <- get_acs(
geography = "tract",
variables = "B01002_001",
state = "TX",
county = "Tarrant",
geometry = TRUE
)