Retrieve SBDI occurrence data via the "occurrence download" web service. At
least one of taxon
, wkt
, or fq
must be supplied for a
valid query.
occurrences( taxon, wkt, fq, fields, extra, qa, generate_doi, email = sbdi_config()$email, email_notify, method, download_reason_id = sbdi_config()$download_reason_id, reason, verbose = sbdi_config()$verbose, record_count_only = FALSE, use_layer_names = TRUE, use_data_table = TRUE )
taxon | string: (optional) query of the form field:value (e.g. "genus:Macropus")
or a free text search (e.g. "macropodidae"). Note that a free-text search is
equivalent to specifying the "text" field (i.e. |
---|---|
wkt | string: (optional) a WKT (well-known text) string providing a spatial polygon within which to search, e.g. "POLYGON((140 -37,151 -37,151 -26,140.131 -26,140 -37))" |
fq | string: (optional) character string or vector of strings, specifying
filters to be applied to the original query. These are of the form
"INDEXEDFIELD:VALUE" e.g. "kingdom:Fungi". See |
fields | string vector: (optional) a vector of field names to return.
Note that the columns of the returned data frame are not guaranteed to retain
the ordering of the field names given here. If not specified, a default list
of fields will be returned. See |
extra | string vector: (optional) a vector of field names to include in
addition to those specified in |
qa | string vector: (optional) list of record issues to include in the
download. Use |
generate_doi | logical: not implemented in SBDI |
(required) string: the email address of the user performing the download [default is set by sbdi_config()] |
|
email_notify | logical: not implemented in SBDI |
method | [Deprecated] |
download_reason_id | numeric or string: (required unless record_count_only is TRUE)
a reason code for the download, either as a numeric ID (currently 0--11) or a
string (see |
reason | string: (optional) user-supplied description of the reason for the download. Providing this information is optional but will help the SBDI to better support users by building a better understanding of user communities and their data requests |
verbose | logical: show additional progress information? [default is set by sbdi_config()] |
record_count_only | logical: if TRUE, return just the count of records that would be downloaded, but don't download them. Note that the record count is always re-retrieved from the SBDI, regardless of the caching settings. If a cached copy of this query exists on the local machine, the actual data set size may therefore differ from this record count. |
use_layer_names | logical: if TRUE, layer names will be used as layer column names in the returned data frame (e.g. "watsonianViceCounties"). Otherwise, layer id value will be used for layer column names (e.g. "cl10009") |
use_data_table | logical: if TRUE, attempt to read the data.csv file using the fread function from the data.table package. Requires data.table to be available. If this fails with an error or warning, or if use_data_table is FALSE, then read.table will be used (which may be slower) |
Data frame of occurrence results, with one row per occurrence record. The columns of the dataframe will depend on the requested fields
Associated SBDI web service for record counts: https://api.biodiversitydata.se/#ws3
Associated SBDI web service for occurrence downloads: https://api.biodiversitydata.se/#ws4
Field definitions: https://docs.google.com/spreadsheet/ccc?key=0AjNtzhUIIHeNdHhtcFVSM09qZ3c3N3ItUnBBc09TbHc
WKT reference: https://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html
sbdi_reasons
for download reasons; sbdi_config
if (FALSE) { x <- occurrences(taxon="genus:Accipiter", fields=c("species","longitude","latitude","common_name","rank","rights"), download_reason_id=10) ## download records in polygon, with no quality assertion information mellan_sve <- "POLYGON((16.551 60.760,18.836 59.801,17.606 58.860,16.199 58.540, 12.244 58.494,12.772 61.523,16.551 60.760))" x <- occurrences(taxon="genus:Accipiter", wkt=mellan_sve, download_reason_id=10, qa="none", verbose = TRUE) y <- occurrences(taxon="taxon_name:%22Accipiter gentilis%22", wkt=mellan_sve, fields=c("latitude","longitude", "family", "collector", "rights"), download_reason_id=10) str(y) ## other filtered searches fq_str<-pick_filter("resource") z <- occurrences(taxon="genus:Accipiter", fields=c("latitude","longitude","rights"), wkt=mellan_sve, fq=fq_str, # e.g. c( "institution_uid:in3", "cl10097:Uppsala"), #fq=c( "collection_uid:co3"), ## Artportalen data collection #fq=c( "data_resource_uid:dr5"), ## Artportalen data resource qa="none", download_reason_id=10) occurrence_plot(z) }