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 (AIANN…
#> 16 cbsa          Core-based statistical areas (CBSA)                            
#> 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 7 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 × 8
#>   id    gnis_url uri                       fid gnis_id name  loaddate           
#> * <chr> <chr>    <chr>                   <int> <chr>   <chr> <dttm>             
#> 1 0707  ""       https://geoconnex.us/r…   189 NA      Wisc… 2017-02-01 00:53:08
#> 2 0709  ""       https://geoconnex.us/r…    65 NA      Rock  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 15 features and 7 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -106.7484 ymin: 30.05369 xmax: -91.8491 ymax: 39.38306
#> Geodetic CRS:  WGS 84
#> # A tibble: 15 × 8
#>    id    name                   gnis_url uri   gnis_id   fid loaddate           
#>  * <chr> <chr>                  <chr>    <chr> <chr>   <int> <dttm>             
#>  1 1102  Upper Arkansas         ""       http… NA         29 2017-04-17 09:39:52
#>  2 1103  Middle Arkansas        ""       http… NA         70 2012-06-11 07:54:59
#>  3 1104  Upper Cimarron         ""       http… NA        133 2012-06-11 07:54:59
#>  4 1105  Lower Cimarron         ""       http… NA        143 2012-06-11 07:54:59
#>  5 1106  Arkansas-Keystone      ""       http… NA        144 2017-04-21 13:34:18
#>  6 1107  Neosho-Verdigris       ""       http… NA        145 2017-04-21 13:34:23
#>  7 1108  Upper Canadian         ""       http… NA        126 2017-09-20 20:59:45
#>  8 1109  Lower Canadian         ""       http… NA        148 2017-04-24 11:26:44
#>  9 1110  North Canadian         ""       http… NA        146 2017-04-21 13:15:51
#> 10 1111  Lower Arkansas         ""       http… NA          7 2017-04-21 13:15:55
#> 11 1112  Red Headwaters         ""       http… NA        147 2017-04-24 08:53:22
#> 12 1113  Red-Washita            ""       http… NA        179 2017-04-24 08:53:22
#> 13 1114  Red-Sulphur            ""       http… NA        175 2017-10-15 23:35:54
#> 14 1305  Rio Grande Closed Bas… ""       http… NA        178 2017-11-05 19:43:51
#> 15 1306  Upper Pecos            ""       http… NA        129 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 2 features and 7 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 × 8
#>   id    name      gnis_url uri                 gnis_id   fid loaddate           
#> * <chr> <chr>     <chr>    <chr>               <chr>   <int> <dttm>             
#> 1 0707  Wisconsin ""       https://geoconnex.… NA        189 2017-02-01 00:53:08
#> 2 0709  Rock      ""       https://geoconnex.… NA         65 2012-06-11 07:54:59
#> # ℹ 1 more variable: geometry <MULTIPOLYGON [°]>

# }