library(ggplot2)
library(rio)
library(sf)
## Linking to GEOS 3.11.2, GDAL 3.8.2, PROJ 9.3.1; sf_use_s2() is TRUE

Importar librerias

linkgeo="https://github.com/Pepix2345/introgeodf/raw/main/maps/worldMap.gpkg"
sf:: st_layers(linkgeo)
## Driver: GPKG 
## Available layers:
##       layer_name geometry_type features fields crs_name
## 1 countryBorders                    252      1   WGS 84
## 2     riverLines                     98      2   WGS 84
## 3     cityPoints         Point      610      3   WGS 84

Ejercicio 1

countries= read_sf(linkgeo, layer="countryBorders")
rivers= read_sf(linkgeo, layer="riverLines")
cities= read_sf(linkgeo, layer="cityPoints")
basemap=ggplot(data=countries)  + geom_sf(fill='grey90') + theme_light()
finalmap=basemap + geom_sf(data=rivers, color='blue') + geom_sf(data=cities, color='red') 
finalmap

Ejercicio 2

Importamos la data tratada en phyton:

linkPeru= "https://github.com/Pepix2345/introgeodf/raw/main/maps/Perumap.gpkg"
sf:: st_layers(linkPeru)
## Driver: GPKG 
## Available layers:
##    layer_name geometry_type features fields crs_name
## 1 Peruborders       Polygon        1      1   WGS 84
## 2  Perupoints         Point        8      3   WGS 84
## 3   Perulines                      5      2   WGS 84
Peru= read_sf(linkPeru, layer= "Peruborders") 
Peru_cities= read_sf(linkPeru, layer= "Perupoints")
Peru_rivers= read_sf(linkPeru, layer= "Perulines")
basePeru= ggplot(data= Peru) + geom_sf(fill= 'red') + theme_light()
finalPeru= basePeru + geom_sf(data= Peru_cities, color= 'white') + geom_sf(data= Peru_rivers, color= 'greenyellow')
finalPeru

linkperurepro="https://github.com/Pepix2345/introgeodf/raw/main/maps/Peru24891.gpkg"

Ejercicio 3

sf:: st_layers(linkperurepro)
## Driver: GPKG 
## Available layers:
##   layer_name geometry_type features fields                crs_name
## 1    country       Polygon        1      1 PSAD56 / Peru west zone
## 2     cities         Point        8      3 PSAD56 / Peru west zone
## 3     rivers                      5      2 PSAD56 / Peru west zone
## 4   airports         Point      204      7 PSAD56 / Peru west zone

`

perurepro= read_sf(linkperurepro, layer= 'country' )
peruairportsrepro= read_sf(linkperurepro, layer= 'airports')
baserepro= ggplot(data= perurepro) + geom_sf(fill= "grey90") + theme_light()
basefinalrepro= baserepro + geom_sf(data= peruairportsrepro, color= "white") + geom_sf(data=Peru_rivers, color= "blue") + geom_sf(data= peruairportsrepro, color="black") + geom_sf(data=Peru_cities, color='red') +  coord_sf(datum = st_crs(perurepro))
basefinalrepro

Ejercicio 4

linkamericas="https://github.com/Pepix2345/introgeodf/raw/main/maps/americas8858.gpkg"
sf:: st_layers(linkamericas)
## Driver: GPKG 
## Available layers:
##   layer_name geometry_type features fields                      crs_name
## 1  countries                     31      3 WGS 84 / Equal Earth Americas
## 2  centroids         Point       31      3 WGS 84 / Equal Earth Americas
americasproject=read_sf(linkamericas, layer='countries')
americascentroids= read_sf(linkamericas, layer = 'centroids')
baseamericas= ggplot(data=americasproject) + geom_sf(fill='grey90') + theme_light()
finalamericas= baseamericas + geom_sf(data=americascentroids, aes(color=Total_ei5_cat), size= 2 + americascentroids$Total_ei5) + 
  guides(size= NULL) + 
  coord_sf(datum= st_crs(americasproject))
finalamericas