USAID-OHA-SI / gisr

OHA Geospatial Analytics Utilities
https://usaid-oha-si.github.io/gisr/
MIT License
2 stars 0 forks source link

extract_locations #23

Open achafetz opened 5 months ago

achafetz commented 5 months ago

Seeing couple issues with extract_locations()

  1. lazy_secrets() can be applied to extract_locations() so the user doesn't have to write their credentials if they have them stores. This will also allow you to move the ordering of the parameter so level can come second and doesn't have to be explicitly referenced
  2. The function doesn't return the orgunituid so there is no way to map these to the MER data.
library(gagglr)
#> ── Attaching core OHA packages ───────────────────────────────── gagglr 0.2.1 ──
#> ✔ gophr 3.2.1 
#> ✔ glamr 1.3.2 
#> ✔ glitr 0.2.5 
#> ✔ gisr  0.2.3
df_coords <- extract_locations("Tanzania", 
                               datim_user(),
                               datim_pwd(),
                               level = 7)
names(df_coords)
#>  [1] "operatingunit_iso" "operatingunit"     "country_iso"      
#>  [4] "countryname"       "label"             "level"            
#>  [7] "geom_type"         "gid"               "nodes"            
#> [10] "nested"            "coordinates"

Created on 2024-02-08 with reprex v2.0.2

baboyma commented 5 months ago

The package is being updated. Try develop branch.

baboyma commented 5 months ago

This is being re-routed to grabr:

# get country uid
uid <- grabr::get_ouuid(cntry)

# pass request to grabr
grabr::datim_pull_hierarchy(ou_uid = uid, add_geom = T)