Queries the geoconnex reference feature server for features of interest.

get_geoconnex_reference(
  AOI,
  type = NULL,
  t_srs = NULL,
  buffer = 0.5,
  status = TRUE
)

Arguments

AOI

bbox, sf polygon or point, or a URL that will return an sf object when passed to read_sf

type

character the feature type chosen from discover_geoconnex_reference

t_srs

character (PROJ string or EPSG code) or numeric (EPSG code). A user specified - target -Spatial Reference System (SRS/CRS) for returned objects. Will default to the CRS of the input AOI if provided, and to 4326 for ID requests.

buffer

numeric. The amount (in meters) to buffer a POINT AOI by for an extended search. Default = 0.5

status

boolean print status or not

Value

sf data.frame containing requested reference features

Examples

# \donttest{

dplyr::distinct(discover_geoconnex_reference()[c("id", "title")])
#> # A tibble: 20 × 2
#>    id            title                                                  
#>    <chr>         <chr>                                                  
#>  1 hu02          HU02                                                   
#>  2 hu04          HU04                                                   
#>  3 hu06          HU06                                                   
#>  4 hu08          HU08                                                   
#>  5 hu10          HU10                                                   
#>  6 hu12          HU12                                                   
#>  7 nat_aq        USGS National Aquifers                                 
#>  8 principal_aq  USGS Principal Aquifers                                
#>  9 sec_hydrg_reg USGS Secondary Hydrogeologic Regions                   
#> 10 gages         Reference Gages                                        
#> 11 mainstems     Reference Mainstems                                    
#> 12 mainstems_v3  Reference Mainstems V3                                 
#> 13 dams          Reference Dams                                         
#> 14 pws           Public Water Systems                                   
#> 15 states        States                                                 
#> 16 counties      Counties                                               
#> 17 aiannh        American Indian/Alaska Native Areas/Hawaiian Home Lands
#> 18 cbsa          Core-based statistical areas                           
#> 19 ua10          Urban Areas                                            
#> 20 places        Places                                                 

AOI <- sf::st_as_sfc(sf::st_bbox(c(xmin = -89.56684, ymin = 42.99816,
                                   xmax = -89.24681, ymax = 43.17192),
                                 crs = "+proj=longlat +datum=WGS84 +no_defs"))

get_geoconnex_reference(AOI, type = "hu04")
#> Simple feature collection with 2 features and 8 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -91.15213 ymin: 41.22784 xmax: -88.18307 ymax: 46.21648
#> Geodetic CRS:  WGS 84
#> # A tibble: 2 × 9
#>   id      fid uri               name  gnis_url gnis_id huc4  loaddate           
#> * <chr> <int> <chr>             <chr> <chr>    <chr>   <chr> <dttm>             
#> 1 0707    189 https://geoconne… Wisc… ""       NA      0707  2017-02-01 00:53:08
#> 2 0709     65 https://geoconne… Rock  ""       NA      0709  2012-06-11 07:54:59
#> # ℹ 1 more variable: geometry <MULTIPOLYGON [°]>

get_geoconnex_reference("https://geoconnex.us/ref/mainstems/315626", type = "hu04", )
#> Warning: GDAL Error 1: schannel: the certificate or certificate chain is based on an untrusted root
#> Error : Cannot open "https://geoconnex.us/ref/mainstems/315626"; The file doesn't seem to exist.
#> Error in UseMethod("st_transform"): no applicable method for 'st_transform' applied to an object of class "try-error"

AOI <- sf::st_sfc(sf::st_point(c(-89.56684, 42.99816)),
                  crs = "+proj=longlat +datum=WGS84 +no_defs")

get_geoconnex_reference(AOI, type = "hu04", buffer = 100000)
#> Simple feature collection with 7 features and 8 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -93.84873 ymin: 40.3987 xmax: -84.7235 ymax: 46.73351
#> Geodetic CRS:  WGS 84
#> # A tibble: 7 × 9
#>   id      fid uri               name  gnis_url gnis_id huc4  loaddate           
#> * <chr> <int> <chr>             <chr> <chr>    <chr>   <chr> <dttm>             
#> 1 0403    187 https://geoconne… Nort… ""       NA      0403  2019-04-02 12:17:54
#> 2 0404     66 https://geoconne… Sout… ""       NA      0404  2019-03-15 10:49:16
#> 3 0704     96 https://geoconne… Uppe… ""       NA      0704  2017-04-18 15:32:25
#> 4 0706     57 https://geoconne… Uppe… ""       NA      0706  2017-02-01 00:53:13
#> 5 0707    189 https://geoconne… Wisc… ""       NA      0707  2017-02-01 00:53:08
#> 6 0709     65 https://geoconne… Rock  ""       NA      0709  2012-06-11 07:54:59
#> 7 0712     62 https://geoconne… Uppe… ""       NA      0712  2019-03-15 10:49:32
#> # ℹ 1 more variable: geometry <MULTIPOLYGON [°]>

# }