Want to see the code? Click on the black boxes on the right to show/hide the code.
A heatmap of the destinations of the aircraft that fly over my house. I’ve rigged up an ADSB receiver to a Raspberry Pi and some software.
The software listens for any aircraft that are overhead - the aircraft broadcast their identifiers, altitude, speed etc.
Over time it’s collected a lot of data about where these aircraft were heading to, and present them on this map.
The map shows the destinations of aircraft that have flown over my house - the size of the circles are proportional to the number of aircraft that were destined to land at that location and the colour represents the average altitude of the aircraft when they overflew.
#First, we'll need to load a bunch of libraries so we can handle and view geospatial data
library(sf)
library(mapview)
library(jsonlite)
#Next, we'll load the data from a JSON file
jsonData <- data.frame(fromJSON('./data/15/watft_destinations.json'))
#We'll need to rename the columns because the JSON file doesn't have any column names
colnames(jsonData) <- c("lat", "lng", "count", "Average Altitude")
#Now we'll convert the data into a spatial object
destinations <- st_as_sf(jsonData, coords = c("lat", "lng"),
crs = 4326)
#Now we'll plot the data
mapviewOptions(basemaps = c("Esri.WorldTopoMap"),
layers.control.pos = "topright",
legend.pos = "bottomleft",
leafletWidth = "100%",
legend = TRUE
)
#We'll use a palette from the mapview package
pal = mapViewPalette("Pastel 1")
mapview(destinations, zcol="Average Altitude", cex="count", col.regions=RColorBrewer::brewer.pal(7, "Reds"))