query_sb_spatial: Query SB based on spatial extent

View source: R/query_sb.R

query_sb_spatialR Documentation

Query SB based on spatial extent

Description

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


#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)

#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)


USGS-R/sbtools documentation built on June 1, 2024, 9:47 p.m.