Skip to contents

Queries ScienceBase based on a spatial bounding box. Accepts either an sp spatial data object (uses the spatial object's bounding box) or long/lat coordinates defining the bounding box limits.

Usage

query_sb_spatial(bbox, long, lat, bb_wkt, ..., limit = 20)

Arguments

bbox

An sf spatial data object. The bounding box of the object is used for the query.

long

A vector of longitude values that will define the boundaries of a bounding box. Min and Max of supplied longitudes are used. (alternate option to bbox).

lat

A vector of latitude values that will define the boundaries of a bounding box. Min and Max of supplied latitude are used. (alternate option to bbox).

bb_wkt

A character string using the Well Known Text (WKT) standard for defining spatial data. Must be a POLYGON WKT object.

...

Additional parameters are passed on to GET

limit

Maximum number of returned items. Will do paging to retrieve results when limit is over 1000. Use with caution, queries 10k results are slow.

Examples

# \donttest{
#specify the latitude and longitude points to define the bounding box range. 
# This is simply bottom left and top right points
query_sb_spatial(long=c(-104.4, -95.1), lat=c(37.5, 41.0), limit=3)
#> [[1]]
#> <ScienceBase Item> 
#>   Title: FSA 10:1 NAIP Imagery m_4009713_sw_14_h_20160720_20161019 3.75 x 3.75 minute JPEG2000 from The National Map
#>   Creator/LastUpdatedBy:      / 
#>   Provenance (Created / Updated):   / 
#>   Children: 
#>   Item ID: 59eb2be5e4b0026a55fe74b3
#>   Parent ID: 51355312e4b0e1603e4fed62
#> 
#> [[2]]
#> <ScienceBase Item> 
#>   Title: FSA 10:1 NAIP Imagery m_4009714_se_14_h_20160720_20161019 3.75 x 3.75 minute JPEG2000 from The National Map
#>   Creator/LastUpdatedBy:      / 
#>   Provenance (Created / Updated):   / 
#>   Children: 
#>   Item ID: 59eb2be5e4b0026a55fe74c3
#>   Parent ID: 51355312e4b0e1603e4fed62
#> 
#> [[3]]
#> <ScienceBase Item> 
#>   Title: FSA 10:1 NAIP Imagery m_4009714_sw_14_h_20160720_20161019 3.75 x 3.75 minute JPEG2000 from The National Map
#>   Creator/LastUpdatedBy:      / 
#>   Provenance (Created / Updated):   / 
#>   Children: 
#>   Item ID: 59eb2be6e4b0026a55fe74c9
#>   Parent ID: 51355312e4b0e1603e4fed62
#> 

#use a pre-formatted WKT polygon to grab data
query_sb_spatial(bb_wkt="POLYGON((-104.4 41.0,-95.1 41.0,-95.1 37.5,-104.4 37.5,-104.4 41.0))", 
                  limit=3)
#> [[1]]
#> <ScienceBase Item> 
#>   Title: FSA 10:1 NAIP Imagery m_4009713_sw_14_h_20160720_20161019 3.75 x 3.75 minute JPEG2000 from The National Map
#>   Creator/LastUpdatedBy:      / 
#>   Provenance (Created / Updated):   / 
#>   Children: 
#>   Item ID: 59eb2be5e4b0026a55fe74b3
#>   Parent ID: 51355312e4b0e1603e4fed62
#> 
#> [[2]]
#> <ScienceBase Item> 
#>   Title: FSA 10:1 NAIP Imagery m_4009714_se_14_h_20160720_20161019 3.75 x 3.75 minute JPEG2000 from The National Map
#>   Creator/LastUpdatedBy:      / 
#>   Provenance (Created / Updated):   / 
#>   Children: 
#>   Item ID: 59eb2be5e4b0026a55fe74c3
#>   Parent ID: 51355312e4b0e1603e4fed62
#> 
#> [[3]]
#> <ScienceBase Item> 
#>   Title: FSA 10:1 NAIP Imagery m_4009714_sw_14_h_20160720_20161019 3.75 x 3.75 minute JPEG2000 from The National Map
#>   Creator/LastUpdatedBy:      / 
#>   Provenance (Created / Updated):   / 
#>   Children: 
#>   Item ID: 59eb2be6e4b0026a55fe74c9
#>   Parent ID: 51355312e4b0e1603e4fed62
#> 
# }