R que R

Maps: OpenStreetMaps con {osmdata}

Tue, Dec 17, 2019
R Maps
#Openstreetmaps #osmdata #maps


Introducción


OpenStreetMap (OSM) es un proyecto colaborativo formado por un gran número de personas que comparten, añaden y mantienen información que permite generar una gran base de datos mediante la cual es posible realizar mapas editables y libres. La información compilada proveniente de dichas contribuciones se distribuye bajo licencia abierta (ODbL según sus siglas en inglés).


Por su parte, el paquete {osmdata} permite descargar e importar información de OpenStreetMap como objetos sp o sf. Este paquete, y la enorme información que contiene la base de datos OMS, nos permite realizar un número ilimitado de mapas.


El paquete {omsdata}


En primer lugar cargamos el paquete {omstada}. Cargamos también el paquete {tidyverse} cuya sintaxis resulta muy útil al trabajar en el entorno de R.



library(osmdata)
library(tidyverse)


Para una descripción en mayor detalle de la información presente en la base de datos de OpenStreetMap conviene echar un vistazo a este enlace. Alternativamente podemos identificar las categorías disponibles indicando el siguiente comando:



available_features()
##   [1] "4wd only"                "abandoned"              
##   [3] "abutters"                "access"                 
##   [5] "addr"                    "addr:city"              
##   [7] "addr:conscriptionnumber" "addr:country"           
##   [9] "addr:district"           "addr:flats"             
##  [11] "addr:full"               "addr:hamlet"            
##  [13] "addr:housename"          "addr:housenumber"       
##  [15] "addr:inclusion"          "addr:interpolation"     
##  [17] "addr:place"              "addr:postcode"          
##  [19] "addr:province"           "addr:state"             
##  [21] "addr:street"             "addr:subdistrict"       
##  [23] "addr:suburb"             "admin level"            
##  [25] "aeroway"                 "agricultural"           
##  [27] "alt name"                "amenity"                
##  [29] "area"                    "atv"                    
##  [31] "backward"                "barrier"                
##  [33] "basin"                   "bdouble"                
##  [35] "bicycle"                 "bicycle road"           
##  [37] "biergarten"              "boat"                   
##  [39] "border type"             "boundary"               
##  [41] "bridge"                  "building"               
##  [43] "building:fireproof"      "building:flats"         
##  [45] "building:levels"         "building:min level"     
##  [47] "building:soft storey"    "busway"                 
##  [49] "charge"                  "construction"           
##  [51] "covered"                 "craft"                  
##  [53] "crossing"                "crossing:island"        
##  [55] "cuisine"                 "cutting"                
##  [57] "cycleway"                "denomination"           
##  [59] "diet"                    "direction"              
##  [61] "dispensing"              "disused"                
##  [63] "disused:shop"            "drink"                  
##  [65] "drive in"                "drive through"          
##  [67] "driving side"            "ele"                    
##  [69] "electrified"             "embankment"             
##  [71] "embedded rails"          "emergency"              
##  [73] "end date"                "entrance"               
##  [75] "est width"               "fee"                    
##  [77] "fire object:type"        "fire operator"          
##  [79] "fire rank"               "foot"                   
##  [81] "ford"                    "forestry"               
##  [83] "forward"                 "frequency"              
##  [85] "fuel"                    "gauge"                  
##  [87] "golf cart"               "goods"                  
##  [89] "hazmat"                  "healthcare"             
##  [91] "healthcare:speciality"   "height"                 
##  [93] "hgv"                     "highway"                
##  [95] "historic"                "horse"                  
##  [97] "ice road"                "incline"                
##  [99] "industrial"              "inline skates"          
## [101] "inscription"             "internet access"        
## [103] "is in:city"              "is in:country"          
## [105] "junction"                "landuse"                
## [107] "lanes"                   "layer"                  
## [109] "leaf cycle"              "leaf type"              
## [111] "leisure"                 "lhv"                    
## [113] "lit"                     "location"               
## [115] "man made"                "maxaxleload"            
## [117] "maxheight"               "maxlength"              
## [119] "maxspeed"                "maxstay"                
## [121] "maxweight"               "maxwidth"               
## [123] "military"                "minspeed"               
## [125] "mofa"                    "moped"                  
## [127] "motor vehicle"           "motorboat"              
## [129] "motorcar"                "motorcycle"             
## [131] "motorroad"               "mountain pass"          
## [133] "mtb scale"               "mtb:description"        
## [135] "mtb:scale:imba"          "name"                   
## [137] "narrow"                  "natural"                
## [139] "noexit"                  "non existent levels"    
## [141] "note"                    "nudism"                 
## [143] "office"                  "official name"          
## [145] "old name"                "oneway"                 
## [147] "opening hours"           "operator"               
## [149] "organic"                 "oven"                   
## [151] "overtaking"              "parking:condition"      
## [153] "parking:lane"            "passing places"         
## [155] "place"                   "power"                  
## [157] "produce"                 "proposed"               
## [159] "protected area"          "psv"                    
## [161] "public transport"        "railway"                
## [163] "railway:preserved"       "railway:track ref"      
## [165] "recycling type"          "ref"                    
## [167] "religion"                "residential"            
## [169] "resource"                "roadtrain"              
## [171] "route"                   "sac scale"              
## [173] "service"                 "service times"          
## [175] "shelter type"            "shop"                   
## [177] "sidewalk"                "site"                   
## [179] "ski"                     "smoothness"             
## [181] "social facility"         "start date"             
## [183] "step count"              "substation"             
## [185] "surface"                 "tactile paving"         
## [187] "tank"                    "tidal"                  
## [189] "toilets:wheelchair"      "toll"                   
## [191] "tourism"                 "tracks"                 
## [193] "tracktype"               "traffic calming"        
## [195] "traffic sign"            "trail visibility"       
## [197] "tunnel"                  "turn"                   
## [199] "type"                    "usage"                  
## [201] "vehicle"                 "vending"                
## [203] "voltage"                 "water"                  
## [205] "wheelchair"              "wholesale"              
## [207] "width"                   "winter road"            
## [209] "wood"


La lista muestra tanto las primary features (características primarias), así como las propiedades adicionales (aditional properties). (Véase de nuevo el link previamente mencionado para una mayor información sobre qué elementos incluye cada categoría)

En cada categoría (primarias o adicional) encontramos unos conceptos clave (key), que se corresponden a los mostrados en la lista previa, y unos valores (tags). Para identificar los tags de, por ejemplo, los conceptos clave (key) de “shop”, “railway” o “highway” podemos especificar los siguientes comandos:



shop_tags <- available_tags("shop")
head(shop_tags)
## [1] "agrarian"  "alcohol"   "anime"     "antiques"  "appliance" "art"



available_tags("railway")
##  [1] "abandoned"        "buffer_stop"      "construction"     "crossing"        
##  [5] "derail"           "disused"          "funicular"        "halt"            
##  [9] "level_crossing"   "light_rail"       "miniature"        "monorail"        
## [13] "narrow_gauge"     "platform"         "preserved"        "rail"            
## [17] "railway_crossing" "roundhouse"       "signal"           "station"         
## [21] "subway"           "subway_entrance"  "switch"           "tram"            
## [25] "tram_stop"        "traverser"        "turntable"        "wash"



available_tags("highway")
##  [1] "bridleway"              "bus_guideway"           "bus_stop"              
##  [4] "construction"           "corridor"               "crossing"              
##  [7] "cycleway"               "elevator"               "emergency_access_point"
## [10] "escape"                 "footway"                "give_way"              
## [13] "living_street"          "milestone"              "mini_roundabout"       
## [16] "motorway"               "motorway_junction"      "motorway_link"         
## [19] "passing_place"          "path"                   "pedestrian"            
## [22] "platform"               "primary"                "primary_link"          
## [25] "proposed"               "raceway"                "residential"           
## [28] "rest_area"              "road"                   "secondary"             
## [31] "secondary_link"         "service"                "services"              
## [34] "speed_camera"           "steps"                  "stop"                  
## [37] "street_lamp"            "tertiary"               "tertiary_link"         
## [40] "toll_gantry"            "track"                  "traffic_mirror"        
## [43] "traffic_signals"        "trailhead"              "trunk"                 
## [46] "trunk_link"             "turning_circle"         "turning_loop"          
## [49] "unclassified"


Las operaciones y los elementos y características mostrados nos resultarán de gran utilidad a la hora de representar en los mapas distintos elementos. Veamos algunos ejemplos.


Mapa de Zaragoza


Para el primer ejemplo práctico vamos a utilizar datos referentes a mi ciudad, Zaragoza. Representaremos diferentes elementos:


Carreteras

Pongamos que nos interesa representar gráficamente la red de carreteras de Zaragoza. En este caso identificaremos highway como key y seleccionaremos un conjunto de valores obtenidos previamente:



carreteras <- getbb("Zaragoza Spain")%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("road", "motorway", "primary", 
                            "secondary", "tertiary")) %>%
  osmdata_sf()


carreteras
## Object of class 'osmdata' with:
##                  $bbox : 41.4516625,-1.1737289,41.9314873,-0.6803895
##         $overpass_call : The call submitted to the overpass API
##                  $meta : metadata including timestamp and version numbers
##            $osm_points : 'sf' Simple Features Collection with 22630 points
##             $osm_lines : 'sf' Simple Features Collection with 3095 linestrings
##          $osm_polygons : 'sf' Simple Features Collection with 49 polygons
##        $osm_multilines : NULL
##     $osm_multipolygons : NULL


Una vez hemos indicado los elementos que nos interesa representar en el mapa, en nuestro caso carreteras, procedemos a graficar utilizando {ggplot2}.



ggplot() +
  geom_sf(data = carreteras$osm_lines,
          inherit.aes = FALSE,
          color = "darkgrey",
          size = .4,
          alpha = .8)+
  labs(title = "Zaragoza",
       subtitle = "Red de carreteras")


El gráfico anterior utiliza las coordenadas obtenidas mediante la función getbb(). De esta forma las coordenadas utilizadas al realizar el mapa anterior han sido las siguientes:



getbb("Zaragoza Spain")
##         min        max
## x -1.173729 -0.6803895
## y 41.451662 41.9314873


No obstante podemos modificar fácilmente dichas coordenadas geográficas. Supongamos, por ejemplo, que nos interesa realizar un mapa de las carreteras de la ciudad de Zaragoza y, a lo sumo, de su perímetro cercano. Una posibilidad sería indicar las coordinadas deseadas con coord_sf de la siguiente forma:



ggplot() +
  geom_sf(data = carreteras$osm_lines,
          inherit.aes = FALSE,
          color = "darkgrey",
          size = .4,
          alpha = .8)+
  coord_sf(xlim = c(-0.98, -0.8), 
           ylim = c(41.6, 41.7),
           expand = FALSE) +
  theme_void() +
  labs(title = "Zaragoza",
       subtitle = "Red de carreteras")


Alternativamente podemos indicar las coordenadas geográficas de nuestro mapa de la siguiente forma:



min <- c(-0.95, 41.6)
max <- c(-0.8, 41.7)
zgz_df <- as.matrix(data.frame(min, max))
row.names(zgz_df) <- c("x","y")



carreteras_B <- zgz_df%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("road", "motorway", "primary", 
                            "secondary", "tertiary")) %>%
  osmdata_sf()

carreteras_B
## Object of class 'osmdata' with:
##                  $bbox : 41.6,-0.95,41.7,-0.8
##         $overpass_call : The call submitted to the overpass API
##                  $meta : metadata including timestamp and version numbers
##            $osm_points : 'sf' Simple Features Collection with 12728 points
##             $osm_lines : 'sf' Simple Features Collection with 2224 linestrings
##          $osm_polygons : 'sf' Simple Features Collection with 11 polygons
##        $osm_multilines : NULL
##     $osm_multipolygons : NULL


El mapa resultante será, evidentemente, similar al obtenido previamente.



ggplot() +
  geom_sf(data = carreteras_B$osm_lines,
          inherit.aes = FALSE,
          color = "darkgrey",
          size = .4,
          alpha = .8) +
  theme_void() +
  labs(title = "Zaragoza",
       subtitle = "Red de carreteras")

Calles

Me resulta difícil identificar mi ciudad observando únicamente su red de carreteras. Por ello vamos a representar en el mapa las calles que conforman la ciudad. Para ello utilizaremos algunas de la subcategorías de las mostradas previamente dentro de la categoría “highway”.



calles <- getbb("Zaragoza Spain")%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("residential", "living_street",
                            "unclassified",
                            "service", "footway")) %>%
  osmdata_sf()



ggplot() +
  geom_sf(data = calles$osm_lines,
          inherit.aes = FALSE,
          color = "darkgrey",
          size = .3,
          alpha = .8)+
  coord_sf(xlim = c(-0.98, -0.8), 
           ylim = c(41.6, 41.7),
           expand = FALSE) +
  theme_void() +
  labs(title = "Zaragoza")


Esto ya me resulta más familiar. Representemos ahora, en el mismo mapa, las calles y la red de carreteras del mapa anterior.



ggplot() +
  geom_sf(data = calles$osm_lines,
          inherit.aes = FALSE,
          color = "darkgrey",
          size = .2,
          alpha = .8)+
  geom_sf(data = carreteras$osm_lines,
          inherit.aes = FALSE,
          color = "black",
          size = .2,
          alpha = .8)+
  coord_sf(xlim = c(-0.98, -0.8), 
           ylim = c(41.6, 41.7),
           expand = FALSE) +
  theme_void() +
  labs(title = "Zaragoza")


Ríos

Zaragoza, sin Ebro, no es Zaragoza. Veamos cómo hacer para representar los ríos y, ya puestos, los canales.


rios <- getbb("Zaragoza Spain")%>%
  opq()%>%
  add_osm_feature(key = "waterway", 
                  value = c("river", "canal")) %>%
  osmdata_sf()
  


Graficamos los ríos (Ebro, Huerva y Gállego) y los diversos canales que fluyen en la ciudad:



ggplot() +
  geom_sf(data = calles$osm_lines,
          inherit.aes = FALSE,
          color = "darkgrey",
          size = .2,
          alpha = .8)+
  geom_sf(data = carreteras$osm_lines,
          inherit.aes = FALSE,
          color = "black",
          size = .2,
          alpha = .8)+
  geom_sf(data = rios$osm_lines,
          inherit.aes = FALSE,
          color = "#7fc0ff",
          size = .8,
          alpha = .8) +
  coord_sf(xlim = c(-0.98, -0.8), 
           ylim = c(41.6, 41.7),
           expand = FALSE) +
  theme_void() +
  labs(title = "Zaragoza")


Es posible realizar modificaciones de algún elemento visual sobre el mapa previo. Pongamos, por ejemplo, que nos atrae más un fondo oscuro para nuestro mapa y queremos representar las calles de un color más vistoso o llamativo. Una posibilidad sería realizar las siguientes operaciones:



ggplot() +
  geom_sf(data = calles$osm_lines,
          inherit.aes = FALSE,
          color = "orange",
          size = .1,
          alpha = .8)+
  geom_sf(data = carreteras$osm_lines,
          inherit.aes = FALSE,
          color = "grey40",
          size = .2,
          alpha = .8)+
  geom_sf(data = rios$osm_lines,
          inherit.aes = FALSE,
          color = "white",
          size = .5,
          alpha = .8) +
  coord_sf(xlim = c(-0.98, -0.8), 
           ylim = c(41.6, 41.7),
           expand = FALSE) +
  theme_void() +
  labs(title = "Zaragoza",
       subtitle = " ") +
  theme(plot.background = element_rect(fill = "black"),
        plot.title = element_text(colour = "white"))


Carriles bici

Zaragoza es una de las ciudades donde el uso de la bicicleta se ha extendido notablemente en los últimos años, tal y como asegura este barómetro de la OCU realizado hace unos años. Tengo curiosidad por comprobar la red de carriles bici existente en la ciudad.



bici <- getbb("Zaragoza Spain")%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("cycleway")) %>%
  osmdata_sf()



ggplot() +
 geom_sf(data = calles$osm_lines,
          inherit.aes = FALSE,
          color = "grey30",
          size = .4,
          alpha = .8) +
  geom_sf(data = carreteras$osm_lines,
          inherit.aes = FALSE,
          color = "grey30",
          size = .1,
          alpha = .8) +
  geom_sf(data = bici$osm_lines,
          inherit.aes = FALSE,
          color = "springgreen",
          size = .4,
          alpha = .6) +
  geom_sf(data = rios$osm_lines,
          inherit.aes = FALSE,
          color = "lightblue",
          size = .2,
          alpha = .5) +
  coord_sf(xlim = c(-0.98, -0.8), 
           ylim = c(41.6, 41.7),
           expand = FALSE) +
  theme_void() +
  labs(title = "Zaragoza",
       subtitle = "Carriles bici") +
  theme(plot.background = element_rect(fill = "black"),
        plot.title = element_text(colour = "white"),
        plot.subtitle= element_text(colour = "white"))


No está mal. Resulta patente que Zaragoza ha apostado por la movilidad sostenible en los últimos años.


Localización de elementos en el mapa

Además de elementos fijos (calles, carriles bici, etc.), OpenStreetMaps nos permite localizar, en un mapa, un gran número de elementos de características diversas. Pongamos por ejemplo que nos interesa identificar y localizar en el mapa de Zaragoza las diferentes sucursales del Banco Santander.



santander <- getbb("Zaragoza Spain")%>%
  opq()%>%
  add_osm_feature("name","Santander")%>%
  add_osm_feature("amenity","bank") %>%
  osmdata_sf()
santander
## Object of class 'osmdata' with:
##                  $bbox : 41.4516625,-1.1737289,41.9314873,-0.6803895
##         $overpass_call : The call submitted to the overpass API
##                  $meta : metadata including timestamp and version numbers
##            $osm_points : 'sf' Simple Features Collection with 0 points
##             $osm_lines : NULL
##          $osm_polygons : 'sf' Simple Features Collection with 0 polygons
##        $osm_multilines : NULL
##     $osm_multipolygons : NULL



ggplot() +
 geom_sf(data = calles$osm_lines,
          inherit.aes = FALSE,
          color = "grey30",
          size = .4,
          alpha = .8) +
  geom_sf(data = carreteras$osm_lines,
          inherit.aes = FALSE,
          color = "grey30",
          size = .1,
          alpha = .8) +
  geom_sf(data = santander$osm_points,
          colour="red",
          fill="red",
          alpha=.6,
          size=2,
          shape=21) +
  geom_sf(data = rios$osm_lines,
          inherit.aes = FALSE,
          color = "lightblue",
          size = .2,
          alpha = .5) +
  coord_sf(xlim = c(-0.98, -0.8), 
           ylim = c(41.6, 41.7),
           expand = FALSE) +
  theme_void() +
  labs(title = "Zaragoza",
       subtitle = "Sucursales del Banco Santander") +
  theme(plot.background = element_rect(fill = "black"),
        plot.title = element_text(colour = "white"),
        plot.subtitle= element_text(colour = "white"))


O puede que nos interese identificar en qué lugar se encuentran los distintos estancos en la ciudad:



estancos <- getbb("Zaragoza Spain")%>%
  opq()%>%
  add_osm_feature(key = "shop", 
                  value = "tobacco") %>%
  osmdata_sf()
estancos
## Object of class 'osmdata' with:
##                  $bbox : 41.4516625,-1.1737289,41.9314873,-0.6803895
##         $overpass_call : The call submitted to the overpass API
##                  $meta : metadata including timestamp and version numbers
##            $osm_points : 'sf' Simple Features Collection with 42 points
##             $osm_lines : NULL
##          $osm_polygons : 'sf' Simple Features Collection with 0 polygons
##        $osm_multilines : NULL
##     $osm_multipolygons : NULL



ggplot() +
 geom_sf(data = calles$osm_lines,
          inherit.aes = FALSE,
          color = "grey30",
          size = .4,
          alpha = .8) +
  geom_sf(data = carreteras$osm_lines,
          inherit.aes = FALSE,
          color = "grey30",
          size = .1,
          alpha = .8) +
  geom_sf(data = estancos$osm_points,
          colour="red",
          fill="red",
          alpha=.6,
          size=2,
          shape=21) +
  geom_sf(data = rios$osm_lines,
          inherit.aes = FALSE,
          color = "lightblue",
          size = .2,
          alpha = .5) +
  coord_sf(xlim = c(-0.98, -0.8), 
           ylim = c(41.6, 41.7),
           expand = FALSE) +
  theme_void() +
  labs(title = "Zaragoza",
       subtitle = "Estancos") +
  theme(plot.background = element_rect(fill = "black"),
        plot.title = element_text(colour = "white"),
        plot.subtitle= element_text(colour = "white"))


Como no soy usuario habitual de este tipo de establecimientos no sabría decir si la lista de estancos de Zaragoza disponible en OpenStreetMaps se encuentra actualizada o no.


Carriles bici en diversas ciudades


A modo de ejemplo, y por mera curiosidad, voy a representar la red de carriles para bicicletas de algunas ciudades. Para ello utilizaré las cordenadas geográficas obtenidas en Openstreetmap.org en función del mapa que considere oportuno realizar.


Londres


min <- c(-0.1672, 51.4787)
max <- c(-0.0072, 51.5396)
lnd_df <- as.matrix(data.frame(min, max))
row.names(lnd_df) <- c("x","y")


bike_london_2 <- lnd_df %>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("cycleway")) %>%
  osmdata_sf()


calles_london_2 <- lnd_df%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("residential", "living_street",
                            "unclassified",
                            "service", "footway")) %>%
  osmdata_sf()



ggplot(bike_london_2$osm_lines) +
  geom_sf(colour="orange",
          alpha=.5,
          size=0.5,
          shape=21)+
  geom_sf(data = calles_london_2$osm_lines,
          inherit.aes = F,
          color = "grey40",
          size = .2,
          alpha = .5)+
  theme_void() +
  labs(title = "Londres") +
  theme(plot.background = element_rect(fill = "black"),
        plot.title = element_text(colour = "white", size = 16, hjust = 0.5))


París


min <- c(2.2680, 48.8281)
max <- c(2.4424, 48.8925)
paris_df <- as.matrix(data.frame(min, max))
row.names(paris_df) <- c("x","y")


bike_paris <- paris_df %>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("cycleway")) %>%
  osmdata_sf()


calles_paris <- paris_df%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("residential", "living_street",
                            "unclassified",
                            "service", "footway")) %>%
  osmdata_sf()



ggplot(bike_paris$osm_lines) +
  geom_sf(colour="orange",
          alpha=.5,
          size=0.5,
          shape=21)+
  geom_sf(data = calles_paris$osm_lines,
          inherit.aes = F,
          color = "grey40",
          size = .2,
          alpha = .5)+
  theme_void() +
  labs(title = "Paris") +
  theme(plot.background = element_rect(fill = "black"),
        plot.title = element_text(colour = "white", size = 16, hjust = 0.5))


Amsterdam


min <- c(4.8573, 52.3571)
max <- c(4.9445, 52.3870)
amst_df <- as.matrix(data.frame(min, max))
row.names(amst_df) <- c("x","y")


bike_amst <- amst_df %>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("cycleway")) %>%
  osmdata_sf()


calles_amst <- amst_df%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("residential", "living_street",
                            "unclassified",
                            "service", "footway")) %>%
  osmdata_sf()



ggplot(bike_amst$osm_lines) +
  geom_sf(colour="orange",
          alpha=.5,
          size=0.5,
          shape=21)+
  geom_sf(data = calles_amst$osm_lines,
          inherit.aes = F,
          color = "grey40",
          size = .2,
          alpha = .5)+
  theme_void() +
  labs(title = "Amsterdam") +
  theme(plot.background = element_rect(fill = "black"),
        plot.title = element_text(colour = "white", size = 16, hjust = 0.5))


México DF


min <- c(-99.2282, 19.3822)
max <- c(-99.0538, 19.4745)
mex_df <- as.matrix(data.frame(min, max))
row.names(mex_df) <- c("x","y")


bike_mex <- mex_df %>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("cycleway")) %>%
  osmdata_sf()


calles_mex <- mex_df%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("residential", "living_street",
                            "unclassified",
                            "service", "footway")) %>%
  osmdata_sf()




ggplot(bike_mex$osm_lines) +
  geom_sf(colour="orange",
          alpha=.5,
          size=0.5,
          shape=21)+
  geom_sf(data = calles_mex$osm_lines,
          inherit.aes = F,
          color = "grey40",
          size = .2,
          alpha = .5)+
  theme_void() +
  labs(title = "México DF") +
  theme(plot.background = element_rect(fill = "black"),
        plot.title = element_text(colour = "white", size = 16, hjust = 0.5))