Data centers | R bloggers

Data centers | R bloggers

0 minutes, 59 seconds Read

[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report a problem with 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 30 Day Card Challenge: « My details » (earlier).

Where are my details? Partly in a data center; probably also with your data… Where are they?

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

We will send one Viaduct 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’s definitely more than just data centers (telecom equipment for example, I think), but I’m okay with that…

Card

dc |> 
  pluck("osm_points") |>
  bind_rows(dc |> 
              pluck("osm_polygons") |> 
              st_centroid()) |> 
  leaflet() |> 
  addTiles() |> 
  addCircleMarkers(
    clusterOptions = markerClusterOptions(),
    popup = ~glue("{name}
{operator}"))


#Data #centers #bloggers

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *