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: 18 × 2
#>    id            title                                                  
#>    <chr>         <chr>                                                  
#>  1 hu02          HU02                                                   
#>  2 hu04          HU04                                                   
#>  3 hu06          HU06                                                   
#>  4 hu08          HU08                                                   
#>  5 hu10          HU10                                                   
#>  6 nat_aq        USGS National Aquifers                                 
#>  7 principal_aq  USGS Principal Aquifers                                
#>  8 sec_hydrg_reg USGS Secondary Hydrogeologic Regions                   
#>  9 gages         Reference Gages                                        
#> 10 mainstems     Reference Mainstems                                    
#> 11 dams          Reference Dams                                         
#> 12 pws           Public Water Systems                                   
#> 13 states        States                                                 
#> 14 counties      Counties                                               
#> 15 aiannh        American Indian/Alaska Native Areas/Hawaiian Home Lands
#> 16 cbsa          Core-based statistical areas                           
#> 17 ua10          Urban Areas                                            
#> 18 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")
#> Starting download of first set of features.
#> 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", )
#> Starting download of first set of features.
#> Simple feature collection with 14 features and 8 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -106.5997 ymin: 31.20962 xmax: -91.8491 ymax: 39.38306
#> Geodetic CRS:  WGS 84
#> # A tibble: 14 × 9
#>    id      fid uri              name  gnis_url gnis_id huc4  loaddate           
#>  * <chr> <int> <chr>            <chr> <chr>    <chr>   <chr> <dttm>             
#>  1 1102     29 https://geoconn… Uppe… ""       NA      1102  2017-04-17 09:39:52
#>  2 1103     70 https://geoconn… Midd… ""       NA      1103  2012-06-11 07:54:59
#>  3 1104    133 https://geoconn… Uppe… ""       NA      1104  2012-06-11 07:54:59
#>  4 1105    143 https://geoconn… Lowe… ""       NA      1105  2012-06-11 07:54:59
#>  5 1106    144 https://geoconn… Arka… ""       NA      1106  2017-04-21 13:34:18
#>  6 1107    145 https://geoconn… Neos… ""       NA      1107  2017-04-21 13:34:23
#>  7 1108    126 https://geoconn… Uppe… ""       NA      1108  2017-09-20 20:59:45
#>  8 1109    148 https://geoconn… Lowe… ""       NA      1109  2017-04-24 11:26:44
#>  9 1110    146 https://geoconn… Nort… ""       NA      1110  2017-04-21 13:15:51
#> 10 1111      7 https://geoconn… Lowe… ""       NA      1111  2017-04-21 13:15:55
#> 11 1112    147 https://geoconn… Red … ""       NA      1112  2017-04-24 08:53:22
#> 12 1113    179 https://geoconn… Red-… ""       NA      1113  2017-04-24 08:53:22
#> 13 1114    175 https://geoconn… Red-… ""       NA      1114  2017-10-15 23:35:54
#> 14 1306    129 https://geoconn… Uppe… ""       NA      1306  2017-09-20 20:59:52
#> # ℹ 1 more variable: geometry <MULTIPOLYGON [°]>

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)
#> Starting download of first set of features.
#> Simple feature collection with 0 features and 0 fields
#> Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
#> Geodetic CRS:  WGS 84
#> # A tibble: 0 × 1
#> # ℹ 1 variable: geometry <GEOMETRY [°]>

# }