Fetch study region geometry from POPS or cache
fetch_study_region.RdLoads study region geometry as an sf object, from cache if available, or from POPS database if not cached. Use to obtain study region boundaries for analysis.
Value
sf object with columns:
geometry
— geometry column region_id
— region identifier Additional columns for region attributes (type varies) Rows: one per region.
Details
Loads from cache if file exists.
Otherwise, fetches from POPS database and saves to cache.
Returns an sf object with geometry column.
Returns a copy; does not modify by reference.
Settings
pops_dir (direct): POPS directory. Default from settings.
dbname (direct): Database name. Default from settings.
schema (direct): Database schema. Default from settings.
See also
connect_to_popsscripts/io/fetch_study_region.R
Other io utilities:
clean_data_dict(),
cut_and_label(),
db_table_has_geometry(),
fetch_acs(),
fetch_all_hts_tables(),
fetch_from_db(),
fetch_hts_table(),
fetch_pums(),
find_project_root(),
fix_value_labels_on_load(),
get_db_table_name(),
print_params(),
pums_checksum(),
read_from_db(),
read_pums_codebook(),
record_checksum(),
sampled_latlon_to_bg()
Examples
## Not run:
settings <- list(pops_dir = "pops", dbname = "hts", schema = "public")
region <- fetch_study_region(settings)
#> Error in get("raw_data_root", settings): object 'raw_data_root' not found
## End(Not run)