library(dplyr)
library(purrr)
library(sf)
library(osmdata)
library(glue)
library(leaflet)Day 4 of 30DayMapChallenge: « My data » (previously).
Where are my data? Partly in a data center; probably with your data too… So, where are they?
We send an Overpass API query with {osmdata}:
# Get and cache OSM data for France
if (!file.exists("dc.rds")) {
dc <- getbb("France métropolitaine") |>
opq(osm_types = "nw", timeout = 6000) |>
add_osm_features(features = list(
"telecom" = "data_center",
"building" = "data_center")) |>
osmdata_sf()
saveRDS(dc, "dc.rds")
} else {
dc <- readRDS("dc.rds")
}There is certainly more than just data centers (telecom equipment for example, I guess), but I’m OK with that…
Map
dc |>
pluck("osm_points") |>
bind_rows(dc |>
pluck("osm_polygons") |>
st_centroid()) |>
leaflet() |>
addTiles() |>
addCircleMarkers(
clusterOptions = markerClusterOptions(),
popup = ~glue("{name}<br>{operator}")) The cloud is just someone else’s computer.
You can try self-hosting…
