library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
library(tidygraph)
#>
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#>
#> filter
regic_link <- st_read(
dsn = "city_link/REGIC2018_Ligacoes_entre_Cidades.shp",
query = "SELECT cod_ori, nome_ori, cod_dest, nome_dest FROM REGIC2018_Ligacoes_entre_Cidades"
)
#> Reading query `SELECT cod_ori, nome_ori, cod_dest, nome_dest FROM REGIC2018_Ligacoes_entre_Cidades' from data source `C:\Users\Utente\Desktop\city_link\REGIC2018_Ligacoes_entre_Cidades.shp'
#> using driver `ESRI Shapefile'
#> Simple feature collection with 32062 features and 4 fields
#> Geometry type: LINESTRING
#> Dimension: XY
#> Bounding box: xmin: -72.9063 ymin: -33.6876 xmax: -32.4102 ymax: 4.5952
#> Geodetic CRS: SIRGAS 2000
regic_link %>%
filter(nome_ori == "Água Boa") %>%
select(cod_ori, nome_ori)
#> Simple feature collection with 19 features and 2 fields
#> Geometry type: LINESTRING
#> Dimension: XY
#> Bounding box: xmin: -56.1004 ymin: -25.5257 xmax: -41.945 ymax: -12.5957
#> Geodetic CRS: SIRGAS 2000
#> First 10 features:
#> cod_ori nome_ori geometry
#> 1 3100609 Água Boa LINESTRING (-42.3909 -17.99...
#> 2 3100609 Água Boa LINESTRING (-42.3909 -17.99...
#> 3 3100609 Água Boa LINESTRING (-42.3909 -17.99...
#> 4 3100609 Água Boa LINESTRING (-42.3909 -17.99...
#> 5 3100609 Água Boa LINESTRING (-42.3909 -17.99...
#> 6 3100609 Água Boa LINESTRING (-42.3909 -17.99...
#> 7 3100609 Água Boa LINESTRING (-42.3909 -17.99...
#> 8 3100609 Água Boa LINESTRING (-42.3909 -17.99...
#> 9 5100201 Água Boa LINESTRING (-52.1618 -14.05...
#> 10 5100201 Água Boa LINESTRING (-52.1618 -14.05...
Created on 2021-08-25 by the reprex package (v2.0.0)