f_get_admin2_boundaries
## The test is actually the QA process!
library(countrycode)
ctr <- countrycode::codelist |>
dplyr::filter( ! is.na(iso3c) ) |>
dplyr::filter(unhcr.region == "The Americas" ) |>
dplyr::select(country.name.en, iso3c) |>
dplyr::arrange( iso3c)
ctr
#> # A tibble: 51 × 2
#> country.name.en iso3c
#> <chr> <chr>
#> 1 Aruba ABW
#> 2 Anguilla AIA
#> 3 Argentina ARG
#> 4 Antigua & Barbuda ATG
#> 5 Caribbean Netherlands BES
#> 6 Bahamas BHS
#> 7 Belize BLZ
#> 8 Bermuda BMU
#> 9 Bolivia BOL
#> 10 Brazil BRA
#> # ℹ 41 more rows
ctr <- ctr |>
dplyr::select(iso3c) |>
dplyr::pull()
## test on faulty.. with ArcGIS server simpification..
BRA2 <- f_get_admin2_boundaries( ISO3 = "BRA",
level = 2,
simple = 1,
simplify = TRUE,
dTolerance = 500)
#> Trying to get data for Brazil.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
# ECU <- f_get_admin2_boundaries(ISO3 = "ECU",level = 2, simplify = TRUE, dTolerance = 500)
# GTM <- f_get_admin2_boundaries(ISO3 = "GTM",level = 2, simplify = TRUE, dTolerance = 500)
# GTM1 <- f_get_admin2_boundaries(ISO3 = "GTM",level = 1, simple = NULL, simplify = TRUE, dTolerance = 500)
# CRI <- f_get_admin2_boundaries(ISO3 = "CRI",level = 2, simplify = TRUE, dTolerance = 500)
# CHL <- f_get_admin2_boundaries(ISO3 = "CHL",level = 2, simplify = TRUE, dTolerance = 500)
# COL <- f_get_admin2_boundaries(ISO3 = "COL",level = 2, simplify = TRUE, dTolerance = 500)
# MEX <- f_get_admin2_boundaries(ISO3 = "MEX",level = 2, simplify = TRUE, dTolerance = 500)
for ( code in ctr ) {
# code <- "GTM"
#cat (paste0(code,"\n"))
t2 <- f_get_admin2_boundaries(ISO3 = code,
level = 2,
simple = NULL,
simplify = TRUE,
dTolerance = 500)
t1 <- f_get_admin2_boundaries(ISO3 = code,
level = 1,
simple = NULL,
simplify = TRUE,
dTolerance = 500)
## Merge back aadm1_name in t2
if ( any( class(t2) !="character" &
nrow(t2) > 0 &
class(t1) !="character" &
nrow(t1) > 0 ) ) {
t2 |>
dplyr::mutate(adm1_pcode = as.character(adm1_pcode)) |>
dplyr::left_join( t1 |>
sf::st_drop_geometry() |>
dplyr::select(pcode, gis_name) |>
dplyr::distinct() |>
dplyr::rename(adm1_pcode = pcode,
adm1_name = gis_name ) |>
dplyr::mutate(adm1_pcode = as.character(adm1_pcode)) ,
by = c("adm1_pcode")) |>
dplyr::select(iso3, pcode, gis_name, adm2_source_code,
adm1_pcode,adm1_name,
gis_status,source, src_date, geometry ) |>
dplyr::filter(gis_status == 14 ) |>
saveRDS( file = here::here("inst/geom", paste0(code,".RDS") ))
}
}
#> Trying to get data for Aruba.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for ABW is 388848......
#> Simplified Geometry size for ABW is 11560 aka 2.97% .....
#> Trying to get data for Aruba.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for ABW is 388672......
#> Simplified Geometry size for ABW is 11384 aka 2.93% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-1.png)
#> Trying to get data for Anguilla.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for AIA is 56696......
#> Simplified Geometry size for AIA is 13080 aka 23.07% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-2.png)
#> Trying to get data for Anguilla.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for AIA is 56480......
#> Simplified Geometry size for AIA is 12864 aka 22.78% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-3.png)
#> Trying to get data for Argentina.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for ARG is 27475360......
#> 81 duplicate in gis_name for: ARG
#> Simplified Geometry size for ARG is 1235984 aka 4.5% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-4.png)
#> Trying to get data for Argentina.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for ARG is 12358408......
#> Simplified Geometry size for ARG is 258648 aka 2.09% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-5.png)
#> Trying to get data for Antigua & Barbuda.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for ATG is 156248......
#> Simplified Geometry size for ATG is 25728 aka 16.47% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-6.png)
#> Trying to get data for Antigua & Barbuda.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for ATG is 155920......
#> Simplified Geometry size for ATG is 25400 aka 16.29% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-7.png)
#> Trying to get data for Caribbean Netherlands.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BES is 104592......
#> Simplified Geometry size for BES is 15128 aka 14.46% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-8.png)
#> Trying to get data for Caribbean Netherlands.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BES is 104096......
#> Simplified Geometry size for BES is 14632 aka 14.06% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-9.png)
#> Trying to get data for Bahamas.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BHS is 4799648......
#> Simplified Geometry size for BHS is 291208 aka 6.07% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-10.png)
#> Trying to get data for Bahamas.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BHS is 4797200......
#> Simplified Geometry size for BHS is 288760 aka 6.02% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-11.png)
#> Trying to get data for Belize.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BLZ is 815536......
#> Simplified Geometry size for BLZ is 63480 aka 7.78% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-12.png)
#> Trying to get data for Belize.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BLZ is 814960......
#> Simplified Geometry size for BLZ is 62344 aka 7.65% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-13.png)
#> Trying to get data for Bermuda.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BMU is 130648......
#> Simplified Geometry size for BMU is 27288 aka 20.89% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-14.png)
#> Trying to get data for Bermuda.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BMU is 129632......
#> Simplified Geometry size for BMU is 26272 aka 20.27% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-15.png)
#> Trying to get data for Bolivia.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BOL is 8556568......
#> 3 duplicate in gis_name for: BOL
#> Simplified Geometry size for BOL is 461320 aka 5.39% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-16.png)
#> Trying to get data for Bolivia.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BOL is 2334416......
#> Simplified Geometry size for BOL is 120808 aka 5.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-17.png)
#> Trying to get data for Brazil.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
#> Trying to get data for Brazil.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BRA is 9204496......
#> Simplified Geometry size for BRA is 590088 aka 6.41% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-18.png)
#> Trying to get data for Barbados.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BRB is 69328......
#> Simplified Geometry size for BRB is 25008 aka 36.07% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-19.png)
#> Trying to get data for Barbados.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for BRB is 68352......
#> Simplified Geometry size for BRB is 24032 aka 35.16% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-20.png)
#> Trying to get data for Canada.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
#> Trying to get data for Canada.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
#> Trying to get data for Chile.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
#> Trying to get data for Chile.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
#> Trying to get data for Colombia.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
#> Trying to get data for Colombia.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for COL is 15920760......
#> Simplified Geometry size for COL is 271640 aka 1.71% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-21.png)
#> Trying to get data for Costa Rica.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for CRI is 3038848......
#> Simplified Geometry size for CRI is 172848 aka 5.69% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-22.png)
#> Trying to get data for Costa Rica.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for CRI is 1352208......
#> Simplified Geometry size for CRI is 53480 aka 3.96% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-23.png)
#> Trying to get data for Cuba.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for CUB is 2725288......
#> 1 duplicate in gis_name for: CUB
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-24.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 1295 has duplicate vertex with edge 1302>
#> Trying to get data for Cuba.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for CUB is 1928120......
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-25.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 1295 has duplicate vertex with edge 1302>
#> Trying to get data for Curaçao.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for CUW is 101752......
#> Simplified Geometry size for CUW is 15088 aka 14.83% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-26.png)
#> Trying to get data for Curaçao.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for CUW is 101504......
#> Simplified Geometry size for CUW is 14840 aka 14.62% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-27.png)
#> Trying to get data for Cayman Islands.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for CYM is 102824......
#> Simplified Geometry size for CYM is 19904 aka 19.36% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-28.png)
#> Trying to get data for Cayman Islands.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for CYM is 102176......
#> Simplified Geometry size for CYM is 19256 aka 18.85% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-29.png)
#> Trying to get data for Dominica.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for DMA is 101736......
#> Simplified Geometry size for DMA is 25256 aka 24.83% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-30.png)
#> Trying to get data for Dominica.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for DMA is 100792......
#> Simplified Geometry size for DMA is 24312 aka 24.12% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-31.png)
#> Trying to get data for Dominican Republic.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for DOM is 7343400......
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-32.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 2311 has duplicate vertex with edge 2314>
#> Trying to get data for Dominican Republic.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for DOM is 3622656......
#> Simplified Geometry size for DOM is 103456 aka 2.86% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-33.png)
#> Trying to get data for Ecuador.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for ECU is 18411464......
#> 2 duplicate in gis_name for: ECU
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-34.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 13759 has duplicate vertex with edge 13762>
#> Trying to get data for Ecuador.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for ECU is 8837168......
#> Simplified Geometry size for ECU is 213928 aka 2.42% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-35.png)
#> Trying to get data for Guadeloupe.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GLP is 771888......
#> Simplified Geometry size for GLP is 21072 aka 2.73% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-36.png)
#> Trying to get data for Guadeloupe.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GLP is 667552......
#> Simplified Geometry size for GLP is 17840 aka 2.67% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-37.png)
#> Trying to get data for Grenada.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GRD is 126656......
#> Simplified Geometry size for GRD is 24416 aka 19.28% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-38.png)
#> Trying to get data for Grenada.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GRD is 126296......
#> Simplified Geometry size for GRD is 24056 aka 19.05% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-39.png)
#> Trying to get data for Guatemala.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GTM is 2194384......
#> 6 duplicate in gis_name for: GTM
#> Simplified Geometry size for GTM is 557272 aka 25.4% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-40.png)
#> Trying to get data for Guatemala.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GTM is 717576......
#> Simplified Geometry size for GTM is 77816 aka 10.84% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-41.png)
#> Trying to get data for French Guiana.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GUF is 1296096......
#> Simplified Geometry size for GUF is 80480 aka 6.21% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-42.png)
#> Trying to get data for French Guiana.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GUF is 365368......
#> Simplified Geometry size for GUF is 26984 aka 7.39% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-43.png)
#> Trying to get data for Guyana.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GUY is 275296......
#> Simplified Geometry size for GUY is 77328 aka 28.09% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-44.png)
#> Trying to get data for Guyana.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for GUY is 200584......
#> Simplified Geometry size for GUY is 48120 aka 23.99% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-45.png)
#> Trying to get data for Honduras.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
#> Trying to get data for Honduras.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for HND is 11839648......
#> Simplified Geometry size for HND is 103504 aka 0.87% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-46.png)
#> Trying to get data for Haiti.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for HTI is 1017744......
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-47.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 644 has duplicate vertex with edge 647>
#> Trying to get data for Haiti.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for HTI is 270240......
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-48.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 1110 has duplicate vertex with edge 1114>
#> Trying to get data for Jamaica.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for JAM is 272808......
#> Simplified Geometry size for JAM is 39176 aka 14.36% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-49.png)
#> Trying to get data for Jamaica.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for JAM is 271600......
#> Simplified Geometry size for JAM is 37968 aka 13.98% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-50.png)
#> Trying to get data for St. Kitts & Nevis.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for KNA is 98888......
#> Simplified Geometry size for KNA is 28808 aka 29.13% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-51.png)
#> Trying to get data for St. Kitts & Nevis.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for KNA is 97688......
#> Simplified Geometry size for KNA is 27608 aka 28.26% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-52.png)
#> Trying to get data for St. Lucia.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for LCA is 107488......
#> Simplified Geometry size for LCA is 26048 aka 24.23% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-53.png)
#> Trying to get data for St. Lucia.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for LCA is 106544......
#> Simplified Geometry size for LCA is 25104 aka 23.56% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-54.png)
#> Trying to get data for Saint Martin (French part).
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for MAF is 5960......
#> Simplified Geometry size for MAF is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-55.png)
#> Trying to get data for Saint Martin (French part).
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for MAF is 61848......
#> Simplified Geometry size for MAF is 12744 aka 20.61% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-56.png)
#> Trying to get data for Mexico.
#> Warning in rm(df_geom): object 'df_geom' not found
#> An Error Occurred
#> Trying to get data for Mexico.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for MEX is 13287184......
#> Simplified Geometry size for MEX is 748264 aka 5.63% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-57.png)
#> Trying to get data for Montserrat.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for MSR is 5960......
#> Simplified Geometry size for MSR is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-58.png)
#> Trying to get data for Montserrat.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for MSR is 5960......
#> Simplified Geometry size for MSR is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-59.png)
#> Trying to get data for Martinique.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for MTQ is 120208......
#> Simplified Geometry size for MTQ is 57200 aka 47.58% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-60.png)
#> Trying to get data for Martinique.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for MTQ is 62256......
#> Simplified Geometry size for MTQ is 17328 aka 27.83% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-61.png)
#> Trying to get data for Nicaragua.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for NIC is 6610840......
#> Simplified Geometry size for NIC is 314528 aka 4.76% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-62.png)
#> Trying to get data for Nicaragua.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for NIC is 3560064......
#> Simplified Geometry size for NIC is 98816 aka 2.78% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-63.png)
#> Trying to get data for Panama.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for PAN is 3632744......
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-64.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 90 has duplicate vertex with edge 93>
#> Trying to get data for Panama.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for PAN is 2827056......
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-65.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 1708 has duplicate vertex with edge 1713>
#> Trying to get data for Peru.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for PER is 11357328......
#> An Error Occurred during geometry simplification
![](get-started_files/figure-html/example-f_get_admin2_boundaries-66.png)
#> <simpleError in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, check = check, tessellate_tol = if (planar) { tessellate_tol_m/s2_earth_radius_meters() } else { Inf })): Loop 0 is not valid: Edge 2 has duplicate vertex with edge 8478>
#> Trying to get data for Peru.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for PER is 3870480......
#> Simplified Geometry size for PER is 240160 aka 6.2% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-67.png)
#> Trying to get data for Puerto Rico.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for PRI is 5960......
#> Simplified Geometry size for PRI is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-68.png)
#> Trying to get data for Puerto Rico.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for PRI is 5960......
#> Simplified Geometry size for PRI is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-69.png)
#> Trying to get data for Paraguay.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for PRY is 16888248......
#> 1 duplicate in gis_name for: PRY
#> Simplified Geometry size for PRY is 543488 aka 3.22% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-70.png)
#> Trying to get data for Paraguay.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for PRY is 4353888......
#> Simplified Geometry size for PRY is 107136 aka 2.46% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-71.png)
#> Trying to get data for El Salvador.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for SLV is 5429928......
#> 6 duplicate in gis_name for: SLV
#> Simplified Geometry size for SLV is 394784 aka 7.27% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-72.png)
#> Trying to get data for El Salvador.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for SLV is 1221536......
#> Simplified Geometry size for SLV is 46656 aka 3.82% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-73.png)
#> Trying to get data for St. Pierre & Miquelon.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for SPM is 5960......
#> Simplified Geometry size for SPM is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-74.png)
#> Trying to get data for St. Pierre & Miquelon.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for SPM is 5960......
#> Simplified Geometry size for SPM is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-75.png)
#> Trying to get data for Suriname.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for SUR is 479272......
#> 2 duplicate in gis_name for: SUR
#> Simplified Geometry size for SUR is 126544 aka 26.4% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-76.png)
#> Trying to get data for Suriname.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for SUR is 259968......
#> Simplified Geometry size for SUR is 46472 aka 17.88% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-77.png)
#> Trying to get data for Sint Maarten.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for SXM is 5960......
#> Simplified Geometry size for SXM is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-78.png)
#> Trying to get data for Sint Maarten.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for SXM is 24368......
#> Simplified Geometry size for SXM is 10872 aka 44.62% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-79.png)
#> Trying to get data for Turks & Caicos Islands.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for TCA is 5960......
#> Simplified Geometry size for TCA is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-80.png)
#> Trying to get data for Turks & Caicos Islands.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for TCA is 5960......
#> Simplified Geometry size for TCA is 5792 aka 97.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-81.png)
#> Trying to get data for Trinidad & Tobago.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for TTO is 370032......
#> Simplified Geometry size for TTO is 38808 aka 10.49% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-82.png)
#> Trying to get data for Trinidad & Tobago.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for TTO is 369544......
#> Simplified Geometry size for TTO is 38320 aka 10.37% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-83.png)
#> Trying to get data for Uruguay.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for URY is 1214880......
#> Simplified Geometry size for URY is 353248 aka 29.08% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-84.png)
#> Trying to get data for Uruguay.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for URY is 605208......
#> Simplified Geometry size for URY is 67640 aka 11.18% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-85.png)
#> Trying to get data for United States.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for USA is 4486216......
#> 1309 duplicate in gis_name for: USA
#> Simplified Geometry size for USA is 4374648 aka 97.51% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-86.png)
#> Trying to get data for United States.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for USA is 309480......
#> Simplified Geometry size for USA is 226664 aka 73.24% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-87.png)
#> Trying to get data for St. Vincent & Grenadines.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for VCT is 115888......
#> Simplified Geometry size for VCT is 22840 aka 19.71% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-88.png)
#> Trying to get data for St. Vincent & Grenadines.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for VCT is 115272......
#> Simplified Geometry size for VCT is 22224 aka 19.28% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-89.png)
#> Trying to get data for Venezuela.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for VEN is 10678984......
#> 62 duplicate in gis_name for: VEN
#> Simplified Geometry size for VEN is 753152 aka 7.05% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-90.png)
#> Trying to get data for Venezuela.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for VEN is 4093384......
#> Simplified Geometry size for VEN is 176232 aka 4.31% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-91.png)
#> Trying to get data for British Virgin Islands.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for VGB is 148144......
#> Simplified Geometry size for VGB is 25240 aka 17.04% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-92.png)
#> Trying to get data for British Virgin Islands.
#> Warning in rm(df_geom): object 'df_geom' not found
#> Geometry size for VGB is 147640......
#> Simplified Geometry size for VGB is 24736 aka 16.75% .....
![](get-started_files/figure-html/example-f_get_admin2_boundaries-93.png)
![](get-started_files/figure-html/example-f_get_admin2_boundaries-94.png)