fetch_ogc_api_mml | R Documentation |
This internal function retrieves spatial data from an OGC API endpoint with pagination support. It handles both limited and unlimited requests, automatically paginating through results when no limit is specified. It includes basic error handling and rate limit handling.
fetch_ogc_api_mml(api_url, limitti = NULL, max_pages = 100)
api_url |
Character. The base URL of the OGC API endpoint. |
limitti |
Numeric or NULL. The maximum number of features to retrieve per request. If NULL, the function first attempts to fetch all available features without pagination (limit=-1) for speed, falling back to pagination with a default limit of 10,000 per request if the no-paging request fails. |
max_pages |
Numeric. The maximum number of pages to fetch during pagination
when |
This function is intended for internal use within the package. It uses the httr2
package to make HTTP requests and sf
to parse GeoJSON responses into spatial data.
When limitti
is NULL, it first attempts to fetch all features in a single request
(limit=-1). If this fails (e.g., due to R's character string size limit), it falls
back to paginating through features by following the "next" links in the API response.
It includes basic rate limit handling for status code 429.
An sf
object containing the retrieved spatial features.
This function is not exported and should only be called by other functions within the package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.