posted Wednesday, January 21, 2015 by Robert Forkel
Tsammalex, a multilingual lexical database on plants and animals, uses
WWF Ecoregions as one facet to navigate species.
Thus whenever new species are added to the database, we have to answer the question
which ecoregions are populated by this species?
As it turns out, this question is relatively easy to answer due to Open Source software
and Open Data. The remainder of this post will be a fairly technical description how to
use the Open Source software
Python,
fiona and
shapely
and Open Data to answer this question.
Information about observations of species is available from GBIF.org via
their great API. In particular we are going
to use the
species/match method to find a GBIF
identifier for a scientific species name and the
occurrence/search method to retrieve
a list of occurrences for this species.
A single occurrence record serialized as JSON looks as follows:
The ecoregion data in the shapefile when read with fiona is presented as
records, with properties looking as
follows:
Now finding ecoregions in which a species has been observed can be done as follows:
Putting it all together we get a script
which can be run as
Which looks about right considering that Ursus maritimus is also known as Polar Bear.