library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6     ✔ purrr   0.3.4
## ✔ tibble  3.1.7     ✔ dplyr   1.0.9
## ✔ tidyr   1.2.0     ✔ stringr 1.4.0
## ✔ readr   2.1.2     ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(osmdata)
## Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library("showtext")
## Warning: package 'showtext' was built under R version 4.2.2
## Loading required package: sysfonts
## Warning: package 'sysfonts' was built under R version 4.2.2
## Loading required package: showtextdb
## Warning: package 'showtextdb' was built under R version 4.2.2
library("sf")
## Linking to GEOS 3.9.1, GDAL 3.3.2, PROJ 7.2.1; sf_use_s2() is TRUE
mardel = "Mar Del Sur, Provincia de Buenos Aires, Argentina"

Calles

streets <- getbb("Mar Del Sur, Provincia de Buenos Aires, Argentina")%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("motorway", "primary", 
                            "secondary", "tertiary")) %>%
  osmdata_sf()
streets
## Object of class 'osmdata' with:
##                  $bbox : -38.359332,-58.0260154,-38.3230695,-57.9733569
##         $overpass_call : The call submitted to the overpass API
##                  $meta : metadata including timestamp and version numbers
##            $osm_points : 'sf' Simple Features Collection with 142 points
##             $osm_lines : 'sf' Simple Features Collection with 20 linestrings
##          $osm_polygons : 'sf' Simple Features Collection with 0 polygons
##        $osm_multilines : NULL
##     $osm_multipolygons : NULL
mardel_1 = getbb(mardel)
streets_1 <- mardel_1 %>%
  opq() %>%
  add_osm_feature(key = "highway", value = "motorway") %>%
  osmdata_sf()

streets_1 = streets_1$osm_lines


streets_2 <- mardel_1 %>%
  opq() %>%
  add_osm_feature(key = "highway", value = "primary") %>%
  osmdata_sf()

streets_2 = streets_2$osm_lines

streets_3 <- mardel_1 %>%
  opq() %>%
  add_osm_feature(key = "highway", value = "secondary") %>%
  osmdata_sf()

streets_3 = streets_3$osm_lines

streets_4 <- mardel_1 %>%
  opq() %>%
  add_osm_feature(key = "highway", value = "tertiary") %>%
  osmdata_sf()

streets_4 = streets_4$osm_lines

Calles chicas

small_streets <- getbb(mardel)%>%
  opq()%>%
  add_osm_feature(key = "highway", 
                  value = c("residential", "living_street",
                            "unclassified",
                            "service", "footway")) %>%
  osmdata_sf()
costa <- getbb(mardel)%>%
  opq()%>%
  add_osm_feature(key = "natural", value = c("coastline")) %>%
  osmdata_sf()

costa = costa$osm_lines
river <- getbb(mardel)%>%
  opq()%>%
  add_osm_feature(key = "waterway", value = c("river","stream","tidal_channel","ditch")) %>%
  osmdata_sf()
getbb(mardel)
##         min       max
## x -58.02602 -57.97336
## y -38.35933 -38.32307
ggplot() +
  geom_sf(data = streets$osm_lines,
          inherit.aes = FALSE,
          color = "black",
          size = .4,
          alpha = .8) +
  coord_sf(xlim = c(-58.02602, -57.97336), 
           ylim = c(-38.35933,-38.32307),
           expand = FALSE) 

ggplot() +
  geom_sf(data = streets$osm_lines,
          inherit.aes = FALSE,
          color = "black",
          size = .4,
          alpha = .8) +
  geom_sf(data = small_streets$osm_lines,
          inherit.aes = FALSE,
          color = "black",
          size = .4,
          alpha = .6) +
  geom_sf(data = river$osm_lines,
          inherit.aes = FALSE,
          color = "black",
          size = .2,
          alpha = .5)+ 
  coord_sf(xlim = c(-58.02602, -57.97336), 
           ylim = c(-38.35933,-38.32307),
           expand = FALSE) 

mapita = ggplot() +
  geom_sf(data = streets_2$osm_lines,
          inherit.aes = FALSE,
          color = "#ffbe7f",
          size = 10,
          alpha = 1)  +
  geom_sf(data = streets_4$osm_lines,
          inherit.aes = FALSE,
          color = "#ffbe7f",
          size = 10,
          alpha = 1)+
  geom_sf(data = small_streets$osm_lines,
          inherit.aes = FALSE,
          color = "#ffbe7f",
          size = 0.4,
          alpha = .9) +
  geom_sf(data = river$osm_lines,
          inherit.aes = FALSE,
          color = "#7fc0ff",
          size = .6,
          alpha = 0.8)+
  geom_sf(data = costa,
          inherit.aes = FALSE,
          color = "#507993",
          size = 5,
          alpha = 0.8) + 
  coord_sf(xlim = c(-58.02602, -57.97336), 
           ylim = c(-38.35933,-38.32307),
           expand = FALSE) +
  theme_void() +
  theme(
    plot.background = element_rect(fill = "#282828")
  )  + theme(plot.title = element_text(size = 22, family = "lato", hjust=.5, color = "#ffbe7f"),
        plot.subtitle = element_text(family = "lato", size = 9, hjust=.5, color = "#ffbe7f", margin=margin(2, 0, 5, 0))) +
  labs(title = "Mar del Sur", subtitle = "-38.35933°N / -57.97336°W")
mapita
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database

## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

ggsave("map.png", mapita,path =  ,width = 8, height = 8)
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
mapita = ggplot() +
  geom_sf(data = streets_2$osm_lines,
          inherit.aes = FALSE,
          
          size = 5,
          alpha = 0.9)  +
  geom_sf(data = streets_4$osm_lines,
          inherit.aes = FALSE,
         
          size = 5,
          alpha = 0.9)+
  geom_sf(data = small_streets$osm_lines,
          inherit.aes = FALSE,
          
          size = .2,
          alpha = 0.8) +
  geom_sf(data = river$osm_lines,
          inherit.aes = FALSE,
          color = "#7fc0ff",
          size = 1,
          alpha = 0.8)+
  geom_sf(data = costa,
          inherit.aes = FALSE,
          color = "#507993",
          size = 5,
          alpha = 0.8) + 
  coord_sf(xlim = c(-58.02602, -57.97336), 
           ylim = c(-38.35933,-38.32307),
           expand = FALSE) +
  theme_void()  + theme(plot.title = element_text(size = 20, family = "lato", face="bold", hjust=.5), plot.subtitle = element_text(family = "lato", size = 8, hjust=.5, margin=margin(2, 0, 5, 0))) +
  labs(title = "Mar del Sur", subtitle = "-38.359°N / -57.973°W")
mapita
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database

## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

ggsave("map.png", mapita,path =  ,width = 6, height = 6)
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
library(ggmap)
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.