| Title: | Fetch Rat and Species Management Data from the RATO or Provincial Databases |
|---|---|
| Description: | This repository contains the functionality to access the unprocessed species management data of RATO vzw or the province of West Flanders via an API call to an ESRI ArcGIS instance. Credentials are required to access this data. |
| Authors: | Pieter Huybrechts [aut, cre] (ORCID: <https://orcid.org/0000-0002-6658-6062>), Damiano Oldoni [ctb] (ORCID: <https://orcid.org/0000-0003-3445-7562>), Lien Reyserhove [ctb] (ORCID: <https://orcid.org/0000-0001-7484-9267>), Peter Desmet [ctb] (ORCID: <https://orcid.org/0000-0002-8442-8025>) |
| Maintainer: | Pieter Huybrechts <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.4.9000 |
| Built: | 2026-10-09 10:26:55 UTC |
| Source: | https://github.com/inbo/ratatouille |
ArcGIS Enterprise allows queries based on the layerOrTableId, this function returns a default resource to query.
get_default_resource(source = NULL)get_default_resource(source = NULL)
source |
Character string of the source to look up the default resource for. Either "rato" or "wfl". |
Character string of the default resource path corresponding to the specified source.
get_default_resource("rato")get_default_resource("rato")
This function retrieves objects from an ArcGIS environment based on the
object_id. It is capable of retrieving a large amount of objects in a single
function call. As to minimize errors it will fetch batch size number of
objects per request, and will operate in parallel: for a maximum of 5000
requests per 60 seconds, having at most 10 requests open at a time.
get_objects( object_ids, source, resource = get_default_resource(source), batch_size = 100 )get_objects( object_ids, source, resource = get_default_resource(source), batch_size = 100 )
object_ids |
Vector of object_ids for a specific resource, these allow you to fetch a specific database record. |
source |
(Required) Character string indicating the source of the data
to fetch. Currently supported data sources: |
resource |
The resource to query. Defaults to the default resource for the given source. |
batch_size |
Number of objects to request per API call, default is 100. Setting this to a lower number will result in more API calls, but will also reduce the risk of timeouts or errors when requesting large datasets. When set to a higher number, the API may timeout or return an error if the dataset is too large. |
To query an ArcGIS REST API you need credentials. Without credentials accessing the raw data is not possible.
tibble of requested objects.
The credentials are stored in your .Renviron file under RATO_USER and
RATO_PWD and/or WFL_USER and WFL_PWD. To get credentials please contact
the data sources directly.
get_token(source)get_token(source)
source |
(Required) Character string indicating the source of the data
to fetch. Currently supported data sources: |
By default tokens expire every 5 minutes, and are cached until they expire.
You can set a different expiry duration by changing the
ratatouille.token_expires_minutes option with options()
Character. An access token for future API calls.
This function lists all object ids for a given resource on a ArcGIS Enterprise.
list_object_ids(source, resource = get_default_resource(source))list_object_ids(source, resource = get_default_resource(source))
source |
(Required) Character string indicating the source of the data
to fetch. Currently supported data sources: |
resource |
The resource to query. Defaults to the default resource for the given source. |
Integer vector of (all) object ids.
Downloading all data for a resource consists of a two step process. First all object ids for a resource are queried. Then the objects are fetched from that resource by their id.
The returned id's are cached by default, but this can be overwritten by
calling memoise::forget(list_object_ids) which will remove the cache and
ensure the next call queries the database (but will reinstate the cache for
any follow up calls).
This function returns all object ids that pass a query for a given resource on a ArcGIS Enterprise.
query_object_ids( source, resource = get_default_resource(source), query = "1=1" )query_object_ids( source, resource = get_default_resource(source), query = "1=1" )
source |
(Required) Character string indicating the source of the data
to fetch. Currently supported data sources: |
resource |
The resource to query. Defaults to the default resource for the given source. |
query |
A SQL where clause to filter the objects to query. Defaults to "1=1" which queries all objects, but can be used to filter the objects to query by any field in the table. For example, if you only want to query objects with a specific value in a field, you can use a query like "field_name = 'value'". |
Integer vector of (filtered) object ids.
query_object_ids("wfl", query = "Gemeente='Koekelare'" )query_object_ids("wfl", query = "Gemeente='Koekelare'" )
This function fetches the raw invasive species data from the specified
source. It supports fetching data from RATO and other sources
as they become available. All records from a source are returned, to fetch
specific records see get_objects().
ratatouille(source, ...)ratatouille(source, ...)
source |
(Required) Character string indicating the source of the data
to fetch. Currently supported data sources: |
... |
Arguments passed on to
|
A data.frame containing the raw invasive species data from the selected source.
ratatouille(source = "rato")ratatouille(source = "rato")