Specifies a sf data frame as the location for a Cal-Adapt API request
ca_loc_sf(x = ca_apireq(), loc, idfld = NULL, idval = NULL, dTolerance = 0)
A Cal-Adapt API request
A simple feature data frame
The name of a column in loc containing unique values, or the name
A vector of unique values
A numeric value used to simplify polgyons, see Details.
loc
should be a simple feature data frame with point or polygon features.
The sf object should have a valid CRS, but does not have to be geographic.
Both 'single' and 'multipart' polygons can be used, but only simple point features are
supported. To convert a multipoint feature layer into a single point layer, use st_cast
.
idfld
should be the name of a column in loc
containing unique values. When you
fetch values from Cal-Adapt, this column will be returned in the results to help you
join the values to other tables. Alternately, you can use idfld
to pass the name of
a new column, together with a vector of unique values in idval
(one for each row
in loc
).
Note you can not use idval
as a filter. If you want to filter the features of loc
to
query, use a filter expression as part of the value of loc
(e.g., with
filter
or slice
).
If loc
is a polygon layer, you'll also need to specify how to spatially aggregate the queried
values if a feature overlaps more than one pixel. See ca_options
.
dTolerance
is a value in decimal degrees used to simplify polygons. If dTolerance > 0
,
geos_unary{st_simplify}
will be called to remove polygon nodes within dTolerance
of another node,
before fetching data. This can reduce the amount of spatial data that needs to be sent to the server,
which can improve performance particularly when you have very fine grained polygons.
Simplifying polygons can modify (generally reduce) the pixels that a polygon overlaps, so use with caution.
dTolerance = 0.001
represents <100m on the ground within Cal-Adapt range of latitude.