{"id":80170,"name":"gbif.range","description":"An R package to generate species range maps based on ecoregions and a user-friendly GBIF wrapper.","url":"https://github.com/8ginette8/gbif.range","last_synced_at":"2026-06-18T01:30:23.725Z","repository":{"id":61602912,"uuid":"553057771","full_name":"8Ginette8/gbif.range","owner":"8Ginette8","description":"An R package to generate species range maps based on ecoregions and a user-friendly GBIF wrapper ","archived":false,"fork":false,"pushed_at":"2026-05-08T13:28:28.000Z","size":232864,"stargazers_count":37,"open_issues_count":0,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-05-29T16:04:13.892Z","etag":null,"topics":["accepted-names","ecoregions","environmental-classification","filtering","flags","gbif-api","hard-limit","iucn-red-list","large-scale","macroecology","r-package","range-maps","species-distribution","species-observations","synonyms","taxonomy"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/8Ginette8.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-10-17T16:41:34.000Z","updated_at":"2026-05-08T13:28:32.000Z","dependencies_parsed_at":"2023-02-15T08:16:14.098Z","dependency_job_id":"75574da9-d959-4721-83d0-7c012a4c896a","html_url":"https://github.com/8Ginette8/gbif.range","commit_stats":{"total_commits":450,"total_committers":4,"mean_commits":112.5,"dds":"0.22888888888888892","last_synced_commit":"e022d3118a4d869360cdb01ea3da1f691adefe65"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/8Ginette8/gbif.range","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8Ginette8%2Fgbif.range","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8Ginette8%2Fgbif.range/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8Ginette8%2Fgbif.range/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8Ginette8%2Fgbif.range/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/8Ginette8","download_url":"https://codeload.github.com/8Ginette8/gbif.range/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8Ginette8%2Fgbif.range/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34342089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"owner":{"login":"8Ginette8","name":"Yohann Chauvier","uuid":"43674773","kind":"user","description":"","email":"","website":null,"location":null,"twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/43674773?v=4","repositories_count":3,"last_synced_at":"2023-04-28T18:38:49.801Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/8Ginette8","funding_links":[],"total_stars":null,"followers":null,"following":null,"created_at":"2023-04-28T18:38:49.804Z","updated_at":"2023-04-28T18:38:49.804Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/8Ginette8","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/8Ginette8/repositories"},"packages":[],"commits":{"id":1360005,"full_name":"8Ginette8/gbif.range","default_branch":"main","total_commits":1019,"total_committers":7,"total_bot_commits":32,"total_bot_committers":1,"mean_commits":145.57142857142858,"dds":0.21491658488714427,"past_year_total_commits":227,"past_year_total_committers":5,"past_year_total_bot_commits":32,"past_year_total_bot_committers":1,"past_year_mean_commits":45.4,"past_year_dds":0.26431718061674003,"last_synced_at":"2026-06-14T06:08:06.021Z","last_synced_commit":"e16c2b40da5cc94690e5d1abfd9bd3df473f8709","created_at":"2023-09-13T13:28:08.680Z","updated_at":"2026-06-14T06:07:52.010Z","committers":[{"name":"Yohann Chauvier","email":"43674773+8Ginette8","login":"8Ginette8","count":800},{"name":"Oskar Hagen","email":"oskar.hagen@outlook.com","login":"ohagen","count":137},{"name":"github-actions[bot]","email":"github-actions[bot]","login":"github-actions[bot]","count":32},{"name":"Yohann Chauvier","email":"yohann.chauvier@wsl.ch","login":null,"count":31},{"name":"Stefan Pinkert","email":"StefanPinkert@gmx.de","login":"PinkertS","count":12},{"name":"Lopez Hugo","email":"hugo.lpz@gmail.com","login":"hugolpz","count":4},{"name":"culi","email":"culitif@tuta.io","login":"tif-calin","count":3}],"past_year_committers":[{"name":"Yohann Chauvier","email":"yohanngichauvier@gmx.com","login":"8Ginette8","count":167},{"name":"github-actions[bot]","email":"github-actions[bot]","login":"github-actions[bot]","count":32},{"name":"Oskar Hagen","email":"oskar.hagen@outlook.com","login":"ohagen","count":21},{"name":"Lopez Hugo","email":"hugo.lpz@gmail.com","login":"hugolpz","count":4},{"name":"culi","email":"culitif@tuta.io","login":"tif-calin","count":3}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/8Ginette8%2Fgbif.range/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-06-15T00:00:11.107Z","repositories_count":6259695,"commits_count":882445972,"contributors_count":35085396,"owners_count":1166707,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"8Ginette8/gbif.range","html_url":"https://github.com/8Ginette8/gbif.range","last_synced_at":"2026-04-11T12:16:21.072Z","status":"active","issues_count":17,"pull_requests_count":10,"avg_time_to_close_issue":8279843.133333334,"avg_time_to_close_pull_request":1193058.0,"issues_closed_count":15,"pull_requests_closed_count":9,"pull_request_authors_count":4,"issue_authors_count":5,"avg_comments_per_issue":2.9411764705882355,"avg_comments_per_pull_request":1.0,"merged_pull_requests_count":9,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":2,"past_year_pull_requests_count":9,"past_year_avg_time_to_close_issue":7876307.5,"past_year_avg_time_to_close_pull_request":1342189.0,"past_year_issues_closed_count":2,"past_year_pull_requests_closed_count":8,"past_year_pull_request_authors_count":3,"past_year_issue_authors_count":2,"past_year_avg_comments_per_issue":8.0,"past_year_avg_comments_per_pull_request":1.1111111111111112,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":8,"created_at":"2023-09-13T13:28:14.924Z","updated_at":"2026-04-11T12:16:21.072Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/8Ginette8%2Fgbif.range","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/8Ginette8%2Fgbif.range/issues","issue_labels_count":{},"pull_request_labels_count":{},"issue_author_associations_count":{"COLLABORATOR":11,"OWNER":3,"CONTRIBUTOR":2,"NONE":1},"pull_request_author_associations_count":{"CONTRIBUTOR":5,"COLLABORATOR":3,"OWNER":1,"NONE":1},"issue_authors":{"ohagen":11,"8Ginette8":3,"hugolpz":1,"karolazvdo":1,"tif-calin":1},"pull_request_authors":{"hugolpz":3,"tif-calin":3,"ohagen":3,"8Ginette8":1},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-06-15T00:00:22.443Z","repositories_count":14805358,"issues_count":33146382,"pull_requests_count":109257217,"authors_count":11306282,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{"CONTRIBUTOR":2},"past_year_pull_request_author_associations_count":{"CONTRIBUTOR":5,"COLLABORATOR":2,"NONE":1},"past_year_issue_authors":{"hugolpz":1,"tif-calin":1},"past_year_pull_request_authors":{"hugolpz":3,"tif-calin":3,"ohagen":2},"maintainers":[{"login":"ohagen","count":14,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ohagen"},{"login":"8Ginette8","count":4,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/8Ginette8"}],"active_maintainers":[{"login":"ohagen","count":2,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ohagen"}]},"events":{"total":{"DeleteEvent":10,"PullRequestEvent":5,"IssuesEvent":5,"WatchEvent":13,"IssueCommentEvent":16,"PushEvent":253,"PullRequestReviewCommentEvent":3,"PullRequestReviewEvent":4,"CreateEvent":1},"last_year":{"DeleteEvent":9,"PullRequestEvent":3,"IssuesEvent":4,"WatchEvent":10,"IssueCommentEvent":16,"PushEvent":120,"PullRequestReviewCommentEvent":3,"PullRequestReviewEvent":4,"CreateEvent":1}},"keywords":["accepted-names","ecoregions","environmental-classification","filtering","flags","gbif-api","hard-limit","iucn-red-list","large-scale","macroecology","r-package","range-maps","species-distribution","species-observations","synonyms","taxonomy"],"dependencies":[{"ecosystem":"cran","filepath":"DESCRIPTION","sha":null,"kind":"manifest","created_at":"2022-10-19T18:30:21.264Z","updated_at":"2022-10-19T18:30:21.264Z","repository_link":"https://github.com/8Ginette8/gbif.range/blob/main/DESCRIPTION","dependencies":[{"id":6422740890,"package_name":"R","ecosystem":"cran","requirements":"\u003e= 4.0.0","direct":true,"kind":"depends","optional":false},{"id":6422740891,"package_name":"raster","ecosystem":"cran","requirements":"*","direct":true,"kind":"depends","optional":false},{"id":6422740892,"package_name":"terra","ecosystem":"cran","requirements":"*","direct":true,"kind":"depends","optional":false},{"id":6422740893,"package_name":"rgbif","ecosystem":"cran","requirements":"*","direct":true,"kind":"depends","optional":false},{"id":6422740894,"package_name":"CoordinateCleaner","ecosystem":"cran","requirements":"*","direct":true,"kind":"depends","optional":false}]}],"score":5.556828061699537,"created_at":"2023-09-19T00:09:26.732Z","updated_at":"2026-06-18T01:30:23.729Z","avatar_url":"https://github.com/8Ginette8.png","language":"R","category":"Biosphere","sub_category":"Biodiversity Data Access and Management","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"# gbif.range R package\n\n[\u003cimg align=\"right\" width=\"250\" height=\"290\" src=\"https://github.com/8Ginette8/gbif.range/blob/main/inst/logo/logo_gbif.range.png\"\u003e](https://www.gbif.org)\n\n[![Auto-Version](https://github.com/8Ginette8/gbif.range/actions/workflows/R-Package-Auto-Version.yml/badge.svg?branch=main)](https://github.com/8Ginette8/gbif.range/actions/workflows/R-Package-Auto-Version.yml)\n[![R-CMD-check](https://github.com/8Ginette8/gbif.range/actions/workflows/R-CMD-check-month-test.yml/badge.svg?branch=main)](https://github.com/8Ginette8/gbif.range/actions/workflows/R-CMD-check-month-test.yml)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n\nSpecies ranges can be estimated from expert maps (for example \u003ca href=\"https://www.iucnredlist.org/resources/spatial-data-download\"\u003eIUCN\u003c/a\u003e and \u003ca href=\"https://www.euforgen.org/species/\"\u003eEUFORGEN\u003c/a\u003e) or with modelling approaches. Expert data, however, remain unavailable for many species, whereas modelling workflows often require substantial technical expertise and large numbers of occurrence records.\n\nWhen such data are unavailable, they can often be approximated from the Global Biodiversity Information Facility (GBIF), the largest public repository of georeferenced species observations worldwide (https://www.gbif.org/). Retrieving GBIF records at large scale in R can still be cumbersome, especially if users are unfamiliar with the practical limits of the *rgbif* package.\n\n**gbif.range** provides a workflow to retrieve GBIF records, filter them for spatial analyses, generate ecologically informed range maps from bundled or custom ecoregions, and evaluate the resulting products. The package also includes utilities to create GBIF-derived DOIs, inspect GBIF taxonomy, and thin large occurrence datasets.\n\n_(source: globe image from the Noun Project adapted by LenaCassie-Studio)_\n\n## Main functions\n\n  - `get_gbif()`: improves the accessibility of the `rgbif` R package (\u003ca href=\"https://cran.r-project.org/web/packages/rgbif/index.html\"\u003eCRAN\u003c/a\u003e) in\n  retrieving GBIF observations of a given species (accepted and synonym names). It uses a dynamic moving windows if the given geographic extent\n  contains \u003e 100,000 observations and implements 13 post-processing options to flag and clean erroneous records based on custom functions and the\n  `CoordinateCleaner` R package (\u003ca href=\"https://cran.r-project.org/web/packages/CoordinateCleaner/index.html\"\u003eCRAN\u003c/a\u003e).\n\n  - `get_gbif_count()`: estimates how many GBIF records are available for a taxon using the same taxonomic matching logic as `get_gbif()`, which is useful before launching large downloads.\n\n  - `get_range()`: estimates species ranges based on occurrence data (a `getGBIF` output or a set of coordinates) and\n  \u003ca href=\"https://en.wikipedia.org/wiki/Ecoregion\"\u003eecoregion\u003c/a\u003e polygons.\n\n  - `read_ecoreg()`: download and read available ecoregion files from different available URL sources. See also associated calls `ecoreg_list`, `get_ecoreg()` and `check_and_get_ecoreg()`.\n    \n  - `get_status()`: generates, based on a given species name, its IUCN red list status and a list of all scientific names\n  (accepted, synonyms) found in the GBIF backbone taxonomy. Children and related doubtful names not used to download the data may also be extracted.\n\n  - `obs_filter()`: `obs_filter()` accepts as input a `getGBIF` output (one or several species) and filter the observations according\n  to a specific given grid resolution. It can retain one observation per grid pixel and/or remove observations from grid pixels that contain fewer than a specified number of records.\n\n  - `make_tiles()`: may be used to generate a set of `SpatialExtent` and geometry arguments `POLYGON()` based on a given\n  geographic extent. This function is meant to help users who want to use the `rgbif` R package and its parameter\n  `geometry` that uses a `POLYGON()` argument.\n\n  - `get_doi()`: a small wrapper of `derived_dataset()` in `rgbif` that simplifies obtaining a general DOI\n  for a set of several gbif species datasets.\n\n  - `make_ecoreg()`: a function to create custom ecoregions based on environmental layers.\n\n  - `evaluate_range()`: evaluation function to validate the species ranges with distribution information provided by the user.\n\n  - `cv_range()`: cross-validation function to evaluate a `getRange` output based on its occurrence data.\n\n  - `make_blocks()`: helper used to split observations into approximately balanced random or spatially structured folds, for example in cross-validation workflows.\n\n  - `split_gbif_by_species()`: streams a large downloaded GBIF table from disk and writes one occurrence file per species or GBIF taxon key without loading the full table into memory.\n\n  - `species_csvs_to_ranges()`: reads those per-species files sequentially, keeps the minimal occurrence columns needed by `get_range()`, and saves one range output per species.\n\n  - `read_range_rds()`: reads back `.rds` range files created by `species_csvs_to_ranges()` and restores the saved range output for plotting or further analysis.\n\n## Installation\n\nYou can install the development version from GitHub with (make sure the R package `remotes` is up to date):\n\n``` r\nremotes::install_github(\"8Ginette8/gbif.range\", build_vignettes = TRUE)\nlibrary(gbif.range)\n```\n\nIf you install from GitHub or a local source tree without `build_vignettes = TRUE`, the package will load normally but `browseVignettes(\"gbif.range\")` will not find the workflow vignettes.\n\n## Vignettes\n\nThe package now includes three focused workflow vignettes:\n\n- `ecoregion-constrained-range-inference`: the core logic of `get_range()`, packaged versus custom ecoregions, and evaluation workflows.\n- `gbif-retrieval-and-taxonomy`: synonym-aware GBIF backbone inspection, credential-free retrieval, filtering, tiling, and GBIF-derived DOIs.\n- `large-downloaded-gbif-tables`: the disk-based workflow for splitting large downloaded GBIF tables and generating one range per species.\n\nAfter installation, open them with:\n\n``` r\nbrowseVignettes(\"gbif.range\")\n\nvignette(\"ecoregion-constrained-range-inference\", package = \"gbif.range\")\nvignette(\"gbif-retrieval-and-taxonomy\", package = \"gbif.range\")\nvignette(\"large-downloaded-gbif-tables\", package = \"gbif.range\")\n```\n\nIf they are not found after a GitHub or local install, reinstall with `build_vignettes = TRUE`, or install the built source tarball with `R CMD INSTALL`.\n\n## Example\n\n### Terrestrial species\n\nLet's download worldwide the records of *Panthera tigris* only based on true observations and literature (default):\n\n``` r\n# Download\nobs.pt \u003c- get_gbif(sp_name = \"Panthera tigris\")\n\n# Plot species records\ncountries \u003c- rnaturalearth::ne_countries(type = \"countries\", returnclass = \"sv\")\nterra::plot(countries, col = \"#bcbddc\")\npoints(obs.pt[, c(\"decimalLongitude\",\"decimalLatitude\")], pch = 20, col = \"#99340470\", cex = 1.5)\n```\n\n![image](https://github.com/user-attachments/assets/2eef058d-3a0f-4b63-b053-7b1e4a94f3a2)\n\n\nNote that the function did not manage to get rid of observations of most likely non-informed captive individuals (e.g., in Europe, U.S. and South Africa); see the `CoordinateCleaner` R package (\u003ca href=\"https://cran.r-project.org/web/packages/CoordinateCleaner/index.html\"\u003eCRAN\u003c/a\u003e) for improved filtering. We can also retrieve the tiger **IUCN red list status**, and its scientific names (accepted and synonyms) that were used in the download with the **GBIF backbone taxonomy**. If all = TRUE, additional children and related doubtful names may also be extracted (not used in `get_gbif()`):\n\n``` r\nget_status(\"Panthera tigris\", all = FALSE)\n```\n\nLet's now extract the terrestrial ecoregions of the world (Nature Conservancy) and generate the distributional range map of *Panthera tigris* :\n\n``` r\n# Download ecoregion and read\neco.terra \u003c- read_ecoreg(ecoreg_name = \"eco_terra\", save_dir = NULL)\n\n# Range\nrange.tiger \u003c- get_range(occ_coord = obs.pt,\n                        ecoreg = eco.terra,\n                        ecoreg_name = \"ECO_NAME\",\n                        degrees_outlier = 5,\n                        clust_pts_outlier = 4)\n```\n\nLet's plot the result now:\n\n``` r\nterra::plot(countries, col = \"#bcbddc\")\nterra::plot(range.tiger$rangeOutput, col = \"#238b45\", add = TRUE, axes = FALSE, legend = FALSE)\n```\n\n![image](https://github.com/user-attachments/assets/97f6d768-4858-42ca-89f4-9d66e2394171)\n\n\nHere, default parameters were employed, however, `clust_pts_outlier` (in degrees, ~440 km here) could have been increased to remove larger isolated clusters of observations, and `degrees_outlier` (~550 km here) to account for more apart observations in the range process. Here, default parameters still allowed to remove obvious tiger observation anomalies in Europe, U.S. and South Africa.\n\n### Available ecoregions\n\nAny suitable shapefile can be supplied to `get_range()`, but the package can also download several ecoregion layers directly: *eco_terra* (for terrestrial species; The Nature Conservancy 2009 adapted from Olson et al. 2001), *eco_marine* (for marine species, two versions; The Nature Conservancy 2012 adapted from Spalding et al. 2007, 2012), and *eco_fresh* (for freshwater species; Abell et al. 2008). Each is available at different levels of detail:\n- *eco_terra* has three different levels: 'ECO_NAME', 'WWF_MHTNAM' and 'WWF_REALM2'.\n- *eco_fresh* has only one: 'ECOREGION'.\n- *eco_marine* and *eco_hd_marine* (the more coastline-precise version) contain three distinct levels: 'ECOREGION', 'PROVINCE' and 'REALM'.\n\nAvailable ecoregion files that can be downloaded with the package:\n``` r\n# List\necoreg_list\n```\n\n### Custom ecoregions\n\nAdditionally, if the in-house ecoregions are too coarse for a given geographic region (e.g., for local studies) or an ecoshapefile of finer environmental details is needed, `make_ecoreg()` can be used based on spatially-informed data (e.g. climate, biodiversity) of desired resolution and extent defining the study area.\n\nExample of 10 ecoregions in the European Alps based on CHELSA bioclimatic layers at 5 × 5 km resolution (Karger et al. 2017), i.e., mean annual air temperature (bio1) and annual precipitation amount (bio12) 1981–2010:\n\n``` r\nbio \u003c- terra::rast(paste0(system.file(package = \"gbif.range\"), \"/extdata/rst.tif\"))\neco.eg \u003c- make_ecoreg(env = bio, nclass = 10)\nterra::plot(eco.eg, col = rainbow(10))\n```\n\u003cimg width=\"450\" height=\"auto\" alt=\"image\" src=\"https://github.com/user-attachments/assets/3e26fe66-fbdd-4854-a24e-125a02d3928e\" /\u003e\n\nLet's further demonstrate how a custom map of ecoregions can be employed in combination with the package's main functions:\n\n``` r\n# Let's download the observations of Arctostaphylos alpinus in the European Alps:\nshp.lonlat \u003c- terra::vect(paste0(system.file(package = \"gbif.range\"), \"/extdata/shp_lonlat.shp\"))\nobs.arcto \u003c- get_gbif(sp_name = \"Arctostaphylos alpinus\",\n                      geo = shp.lonlat,\n                      grain = 1)\n\n# Create an ecoregion layer of 200 classes, based on two environmental spatial layers:\nrst \u003c- terra::rast(paste0(system.file(package = \"gbif.range\"), \"/extdata/rst.tif\"))\nmy.eco \u003c- make_ecoreg(env = rst,\n                        nclass = 200)\n\n# Create the range map based on our custom ecoregion\n# (always set 'EcoRegion' as a name when using a make_ecoreg() output):\nrange.arcto \u003c- get_range(occ_coord = obs.arcto,\n                        ecoreg = my.eco,\n                        ecoreg_name = \"EcoRegion\",\n                        degrees_outlier = 5,\n                        clust_pts_outlier = 4,\n                        res = 0.05)\n```\n\nUnlike at larger-scales, we have here decreased the `get_gbif()` `grain` parameter from 100km to 1km, as keeping observations with a precision of 100km would have been too coarse to infer the approximate range distribution of the species relative to the study extent. `degrees_outlier` and `clust_pts_outlier` were here also kept defaults (~550 and 440 km, respectively), so relative to the study extent, almost no clustered or too distance observations were considered outliers.\n\nIt is also important to note that the resolution parameter (`res`) can be changed to adjust how fine the spatial output should be. This highest possible resolution will only depend on the precision of the `ecoreg` object (e.g., a range output can reach the same resolution of the rasters used to create a `make_ecoreg` object).\n\n``` r\n# Plot\nalps.shp \u003c- terra::crop(countries,terra::ext(rst))\nr.arcto \u003c- terra::mask(range.arcto$rangeOutput,alps.shp)\nterra::plot(alps.shp, col = \"#bcbddc\")\nterra::plot(r.arcto, add = TRUE, col = \"darkgreen\", axes = FALSE, legend = FALSE)\npoints(obs.arcto[, c(\"decimalLongitude\",\"decimalLatitude\")], pch = 20, col = \"#99340470\", cex = 1)\n```\n\n\u003cimg width=\"559\" height=\"394\" alt=\"image\" src=\"https://github.com/user-attachments/assets/39928ecc-d5b8-4063-8980-cf5efae2833f\" /\u003e\n\n\n### Marine species\n\nLet's reapply the same process as for Panthera tigris, but with the marine species *Delphinus delphis* (\u003e 100'000 observations).\n\n⚠️Notes that the download takes here longer unless the parameter `occ_samp` is used. Altough giving **less precise observational distribution**, `occ_samp` allows to extract a **subsample of *n* GBIF observations** per created tiles over the study area:\n\n``` r\n# Here the example is a sample of 1000 observations per geographic tile\nobs.dd \u003c- get_gbif(\"Delphinus delphis\", occ_samp = 1000)\n\n# Here the list is longer because 'all=TRUE' includes every names (even doubtful)\nget_status(\"Delphinus delphis\", all = TRUE)\n```\n\nLet's now generate three range maps of *Delphinus delphis* using the *eco.marine* as ecoregion shapefile:\n\n``` r\n# Download ecoregion and read\neco.marine \u003c- read_ecoreg(ecoreg_name = \"eco_marine\", save_dir = NULL)\n\n# Range from different levels\nrange.dd1 \u003c- get_range(obs.dd, eco.marine, \"ECOREGION\")\nrange.dd2 \u003c- get_range(obs.dd, eco.marine, \"PROVINCE\")\nrange.dd3 \u003c- get_range(obs.dd, eco.marine, \"REALM\")\n```\n\nThe three results are pretty similar because most of the observations are near the coast. But let's plot the first more fine result:\n\n``` r\nterra::plot(countries, col = \"#bcbddc\")\nterra::plot(range.dd3$rangeOutput, col = \"#238b45\", add = TRUE, axes = FALSE, legend = FALSE)\npoints(obs.dd[, c(\"decimalLongitude\",\"decimalLatitude\")], pch = 20, col = \"#99340470\", cex = 1)\n```\n\n![image](https://github.com/user-attachments/assets/52d63434-f64b-4076-b8bc-d3c03c899137)\n\nAlthough our result map follows the sampling pattern found in \u003ca href=\"https://www.gbif.org/species/8324617\"\u003eGBIF\u003c/a\u003e, the dolphin range map might have been improved if more GBIF observations would have been extracted. Therefore, `occ_samp` must be in this case increased or removed.\n\n### Large downloaded GBIF tables\n\nFor very large multi-species GBIF exports already stored on disk, the package also provides a disk-based workflow:\n\n``` r\ngbif_file \u003c- system.file(\"extdata\", \"occ_example_4sps.csv\", package = \"gbif.range\")\n\nsplit_dir \u003c- file.path(tempdir(), \"gbif_split\")\nrange_dir \u003c- file.path(tempdir(), \"gbif_ranges\")\n\n# Split one downloaded GBIF table into one species file per GBIF key.\nsplit_summary \u003c- split_gbif_by_species(\n  input_file = gbif_file,\n  outdir = split_dir,\n  chunk_size = 100,\n  sep_in = \"\\t\",\n  sep_out = \"\\t\",\n  overwrite = TRUE,\n  verbose = FALSE\n)\n\n# Build one range per species from those on-disk occurrence files.\nrange_summary \u003c- species_csvs_to_ranges(\n  species_dir = split_dir,\n  ecoreg = \"eco_terra\",\n  ecoreg_name = \"ECO_NAME\",\n  outdir = range_dir,\n  range_save_as = \"rds\",\n  overwrite = TRUE,\n  verbose = FALSE\n)\n\n# Read one saved range back from disk.\nrg \u003c- read_range_rds(range_summary$range_file[1])\nterra::plot(rg$rangeOutput)\n```\n\nThis disk-based workflow is described in more detail in the vignette `large-downloaded-gbif-tables`.\n\n## Citation\n\nYohann Chauvier, Oskar Hagen, Stefan Pinkert, Camille Albouy, Fabian Fopp, Philipp Brun, Patrice Descombes, Florian Altermatt, Loic Pellissier, Katalin Csilléry. gbif.range: An R package to generate ecologically-informed species range maps from occurrence data with seamless GBIF integration. Authorea. June 30, 2025.\ndoi: \u003ca href=\"https://doi.org/10.22541/au.175130858.83083354/v1\"\u003e10.22541/au.175130858.83083354/v1\u003c/a\u003e\n\n## References \n\nChamberlain, S., Oldoni, D., \u0026 Waller, J. (2022). rgbif: interface to the global biodiversity information facility API. doi: \u003ca href=\"https://doi.org/10.5281/zenodo.6023735\"\u003e10.5281/zenodo.6023735\u003c/a\u003e\n\nKarger, D.N., Conrad, O., Böhner, J., Kawohl, T., Kreft, H., Soria-Auza, R.W., Zimmermann, N.E., Linder, H.P., , Kessler, M. (2017). Climatologies at high resolution for the earth’s land surface areas. Sci Data 4, 170122. doi: \u003ca href=\"https://doi.org/10.1038/sdata.2017.122\"\u003e10.1038/sdata.2017.122\u003c/a\u003e\n\nZizka, A., Silvestro, D., Andermann, T., Azevedo, J., Duarte Ritter, C., Edler, D., ... \u0026 Antonelli, A. (2019). CoordinateCleaner: Standardized cleaning of occurrence records from biological collection databases. Methods in Ecology and Evolution, 10(5), 744-751. doi: \u003ca href=\"https://doi.org/10.1111/2041-210X.13152\"\u003e10.1111/2041-210X.13152\u003c/a\u003e\n\nHijmans, Robert J. \"terra: Spatial Data Analysis. R Package Version 1.6-7.\" (2022). Link to package: \u003ca href=\"https://cran.r-project.org/web/packages/terra/index.html\"\u003eterra - CRAN\u003c/a\u003e\n\nHagen, O., Vaterlaus, L., Albouy, C., Brown, A., Leugger, F., Onstein, R. E., Novaes de Santana, C., Scotese, C. R., \u0026 Pellissier, L. (2019). Mountain building, climate cooling and the richness of cold-adapted plants in the Northern Hemisphere. Journal of Biogeography, 46(8), 1792-1807. doi: \u003ca href=\"https://doi.org/10.1111/jbi.13653\"\u003e10.1111/jbi.13653\u003c/a\u003e\n\nHagen, O. Species_Range_Mapping. GitHub repository. Available at: \u003ca href=\"https://github.com/ohagen/Species_Range_Mapping\"\u003ehttps://github.com/ohagen/Species_Range_Mapping\u003c/a\u003e\n\nOlson, D. M., Dinerstein, E., Wikramanayake, E. D., Burgess, N. D., Powell, G. V. N., Underwood, E. C., D'Amico, J. A., Itoua, I., Strand, H. E., Morrison, J. C., Loucks, C. J., Allnutt, T. F., Ricketts, T. H., Kura, Y., Lamoreux, J. F., Wettengel, W. W., Hedao, P., Kassem, K. R. 2001. Terrestrial ecoregions of the world: a new map of life on Earth. BioScience 51(11):933-938.  doi: \u003ca href=\"https://doi.org/10.1641/0006-3568(2001)051[0933:TEOTWA]2.0.CO;2\"\u003e10.1641/0006-3568(2001)051\u003c/a\u003e\n\nThe Nature Conservancy (2009). Global Ecoregions, Major Habitat Types, Biogeographical Realms and The Nature Conservancy Terrestrial Assessment Units. GIS layers developed by The Nature Conservancy with multiple partners, combined from Olson et al. (2001), Bailey 1995 and Wiken 1986. Cambridge (UK): The Nature Conservancy. Data URL: https://geospatial.tnc.org/datasets/b1636d640ede4d6ca8f5e369f2dc368b/about\n\nMark D. Spalding, Helen E. Fox, Gerald R. Allen, Nick Davidson, Zach A. Ferdaña, Max Finlayson, Benjamin S. Halpern, Miguel A. Jorge, Al Lombana, Sara A. Lourie, Kirsten D. Martin, Edmund McManus, Jennifer Molnar, Cheri A. Recchia, James Robertson, Marine Ecoregions of the World: A Bioregionalization of Coastal and Shelf Areas, BioScience, Volume 57, Issue 7, July 2007, Pages 573–583. doi: \u003ca href=\"https://doi.org/10.1641/B570707\"\u003e10.1641/B570707\u003c/a\u003e\n\nSpalding, M. D., Agostini, V. N., Rice, J., \u0026 Grant, S. M. (2012). Pelagic provinces of the world: a biogeographic classification of the world’s surface pelagic waters. Ocean \u0026 Coastal Management, 60, 19-30. doi: \u003ca href=\"https://doi.org/10.1016/j.ocecoaman.2011.12.016\"\u003e10.1016/j.ocecoaman.2011.12.016\u003c/a\u003e\n\nThe Nature Conservancy (2012). Marine Ecoregions and Pelagic Provinces of the World. GIS layers developed by The Nature Conservancy with multiple partners, combined from Spalding et al. (2007) and Spalding et al. (2012). Cambridge (UK): The Nature Conservancy. Data URL: http://data.unep-wcmc.org/datasets/38\n\nRobin Abell, Michele L. Thieme, Carmen Revenga, Mark Bryer, Maurice Kottelat, Nina Bogutskaya, Brian Coad, Nick Mandrak, Salvador Contreras Balderas, William Bussing, Melanie L. J. Stiassny, Paul Skelton, Gerald R. Allen, Peter Unmack, Alexander Naseka, Rebecca Ng, Nikolai Sindorf, James Robertson, Eric Armijo, Jonathan V. Higgins, Thomas J. Heibel, Eric Wikramanayake, David Olson, Hugo L. López, Roberto E. Reis, John G. Lundberg, Mark H. Sabaj Pérez, Paulo Petry, Freshwater Ecoregions of the World: A New Map of Biogeographic Units for Freshwater Biodiversity Conservation, BioScience, Volume 58, Issue 5, May 2008, Pages 403–414. doi: \u003ca href=\"https://doi.org/https://doi.org/10.1641/B580507\"\u003e10.1641/B580507\u003c/a\u003e\n","funding_links":[],"readme_doi_urls":["https://doi.org/10.22541/au.175130858.83083354/v1","https://doi.org/10.5281/zenodo.6023735","https://doi.org/10.1038/sdata.2017.122","https://doi.org/10.1111/2041-210X.13152","https://doi.org/10.1111/jbi.13653","https://doi.org/10.1641/0006-3568(2001)051","https://doi.org/10.1641/B570707","https://doi.org/10.1016/j.ocecoaman.2011.12.016","https://doi.org/https://doi.org/10.1641/B580507"],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":["occurrence-records","iucn"],"project_url":"https://ost.ecosyste.ms/api/v1/projects/80170","html_url":"https://ost.ecosyste.ms/projects/80170"}