Site icon R-bloggers

Data centers

[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

6509Es – CC-BY-NC by Bob Mical

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?

library(dplyr)
library(purrr)
library(sf)
library(osmdata)
library(glue)
library(leaflet)

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…

< section id="map" class="level2">

Map

dc |> 
  pluck("osm_points") |>
  bind_rows(dc |> 
              pluck("osm_polygons") |> 
              st_centroid()) |> 
  leaflet() |> 
  addTiles() |> 
  addCircleMarkers(
    clusterOptions = markerClusterOptions(),
    popup = ~glue("{name}<br>{operator}")) 
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Exit mobile version