Accessing the Global Biodiversity Information Facility via REST
The GBIF (http://www.gbif.org) gives the available information about biodiversity in a programmatic friendly way using a REST API.
In GBIF, we will find evidence of the occurrence of species across the planet, and much of this information is geo-referenced.
In this recipe, we will concentrate on two types of GBIF information: species and occurrences.
Species are actually a more general taxonomic framework, and occurrences record the observations of species.
In this recipe, we will try to extract biodiversity information related to bears. You can find this content in the Chapter10/GBIF.ipynb
Notebook.
How to do it...
Let's take a look at the following steps:
- First, let's define a function to get the data on REST, as shown in the following code:
import requests def do_request(service, a1=None, a2=None, a3=None, **kwargs): server = 'http://api.gbif.org/v1' params = '' for a in [a1, a2, a3]: if a is not None: ...