SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
GBIF & Species2000 Hackathon
March 2015
Naturalis, Leiden
GBIF portal API
Dag Endresen
GBIF Norway
UiO Natural History Museum in Oslo
University of Oslo
Tuesday, March 3rd, 2015
Slides: CC-BY-4.0
Credits, some slides from:
Daniel Amariles, Colombia
(2013) Nodes training at
GBIF GB20 in Berlin [link]
Gallien Labeyrie, France
(2014) Mentoring project
France-Spain-Portugal
[link]
GBIF DATA PORTAL
SPECIES SEARCH
GBIF DATA PORTAL API
	
  
An interface to access
data published through
the GBIF network using
web services.
	
  
DATA PORTAL API
GBIF Data Portal API:
http://api.gbif.org/v1/ (+parameters)
Summary and information:
http://www.gbif.org/developer/summary
The RESTful API take search parameters as
key=value pairs and respond with json content
type.
RESTful query format
JSON response type
GBIF API sections
	
  
•  Registry	
  	
  
informa)on	
  about	
  the	
  datasets,	
  organiza)ons	
  (e.g.	
  data	
  publishers),	
  
networks	
  and	
  the	
  means	
  to	
  access	
  them	
  (technical	
  endpoints)	
  
•  Species	
  
informa)on	
  about	
  species	
  and	
  higher	
  taxa,	
  and	
  u)lity	
  services	
  for	
  
interpre)ng	
  names	
  and	
  looking	
  up	
  the	
  iden)fiers	
  (access	
  to	
  all	
  published	
  
checklists	
  in	
  the	
  GBIF	
  checklist	
  bank)	
  
•  Occurrence	
  
occurrence	
  informa)on	
  crawled	
  and	
  indexed	
  by	
  GBIF	
  and	
  search	
  services	
  
to	
  do	
  real	
  )me	
  paged	
  search	
  and	
  asynchronous	
  download	
  services	
  to	
  do	
  
large	
  batch	
  downloads	
  
•  Maps	
  
simple	
  services	
  to	
  show	
  the	
  maps	
  of	
  GBIF	
  mobilized	
  content	
  
•  News	
  
services	
  to	
  stream	
  useful	
  informa)on	
  (RSS)	
  
API example : dataset
Search for datasets by publishing country:
http://api.gbif.org/v1/dataset/search?publishingCountry=NO
Dataset information (UiO NHM Lichens):
http://api.gbif.org/v1/dataset/7948250c-6958-4a29-a670-
ed1015b26252
Contact persons for a dataset:
http://api.gbif.org/v1/dataset/7948250c-6958-4a29-a670-
ed1015b26252/contact
Dataset endpoint (get download URL):
http://api.gbif.org/v1/dataset/7948250c-6958-4a29-a670-
ed1015b26252/endpoint
http://www.gbif.org/developer/registry
API example : dataset
Download activity metrics for dataset (UiO NHM Lichens):
http://api.gbif.org/v1/occurrence/download/dataset/
7948250c-6958-4a29-a670-ed1015b26252
=> records from this dataset, included in 2650 download sets
Records lastInterpreted since November 2014:
http://api.gbif.org/v1/occurrence/search?
datasetKey=7948250c-6958-4a29-a670-
ed1015b26252&lastInterpreted=2014-11-01,* (=> 168 316 occ.)
Metrics for dataset data contents:
http://api.gbif.org/v1/dataset/66dd0960-2d7d-46ee-
a491-87b9adcfe7b1/metrics
=> count records by dimensions such as Kingdom, Rank, Vernacular
name langue, Extensions provided, …
NB! only implemented for species checklists, not (yet?) for occurrences!
http://www.gbif.org/developer/registry
API example : species
List all name usages (across all checklists):
http://api.gbif.org/v1/species?name=Beta%20vulgaris
Name usage across checklists (Beta vulgaris, 5383920):
http://api.gbif.org/v1/species/5383920/related
Name parsed into epithets and author etc.:
http://api.gbif.org/v1/parser/name?name=Abies%20alba
%20Mill.%20sec.%20Markus%20D.
{"scientificName": "Abies alba Mill. sec. Markus D.",
"type": "SCINAME",
"genusOrAbove": "Abies",
"specificEpithet": "alba",
"authorsParsed": true,
"authorship": "Mill.",
"sensu": "sec. Markus D.",
"canonicalName": "Abies alba",
"canonicalNameWithMarker": "Abies alba",
"canonicalNameComplete": "Abies alba Mill."
}
http://www.gbif.org/developer/species
API example : occurrence
List occurrences of Beta vulgaris:
http://api.gbif.org/v1/species/match?name=Beta+vulgaris => taxonKey
http://api.gbif.org/v1/occurrence/search?taxonKey=5383920
List occurrences from Norway (of Beta vulgaris):
http://api.gbif.org/v1/occurrence/search?publishingCountry=NO
http://api.gbif.org/v1/occurrence/search?publishingCountry=NO&taxonKey=5383920
Information about a single occurrence record:
http://api.gbif.org/v1/occurrence/1040970640
http://api.gbif.org/v1/occurrence/1040970640/fragment
http://api.gbif.org/v1/occurrence/1040970640/verbatim
List occurrence counts for datasets of country (or taxon):
http://api.gbif.org/v1/occurrence/counts/datasets?country=NO
http://www.gbif.org/developer/occurrence
API example : identifiers
(not implemented -- yet)
Searching by occurrenceID is unfortunately
not supported yet …
http://dev.gbif.org/issues/browse/POR-2451
http://dev.gbif.org/issues/browse/POR-2337
So, we cannot yet list or count occurrences with pattern “urn*” in occurrenceID
http://api.gbif.org/v1/occurrence/search?occurrenceID=urn*
http://api.gbif.org/v1/occurrence/search?occurrenceID=urn%3Acatalog
http://api.gbif.org/v1/occurrence/search?occurrenceID=urn%3Alsid
http://api.gbif.org/v1/occurrence/search?occurrenceID=http*
…
API example : download data
Lookup speciesKey (1) and download occurrences (2):
http://api.gbif.org/v1/species/match?
verbose=false&kingdom=Plantae&name=Beta+vulgaris
=> usageKey/speciesKey = 5383920
http://api.gbif.org/v1/occurrence/search?
taxonKey=5383920 [&limit=1000&offset=0]
=> notice: count = 25 513
=> then: page through results…
(using offset & limit)
http://api.gbif.org/v1/occurrence/download/request
[POST] => downloadKey (see next slide)
API example : asynchronous (1)
Request asynchronous download:
$ curl -i --user yourGbifUserName:yourGbifPassord -H
"Content-Type: application/json" -H "Accept: application/json"
-X POST -d @filter.json http://api.gbif.org/v1//occurrence/
download/request >> log.txt
Search parameters in a json text file: filter.json (in current
directory or located in a “PATH-directory”):
{
"creator":”yourGbifUserName",
"notification_address": [“yourEmail@mail.net"],
"predicate":
{
"type":"and",
"predicates":
[{"type":"equals","key":"HAS_COORDINATE","value":"false"},
{"type":"equals","key":"TAXON_KEY","value":"5383920"}]
}
}
Downloads are available in the
portal (from your user profile)
API example : asynchronous (2a)
Request asynchronous download:
function gbifapi {
curl -i –user yourGbifUserName:yourGbifPassword -H "Content-Type: application/
json" -H "Accept: application/json" -X POST -d "{"creator":”yourGbifUserName
", "notification_address": [”yourEmail@mail.net"], "predicate": {"type":
"and", "predicates": [{"type":"equals","key":"HAS_COORDINATE","value
":"true"}, {"type":"equals", "key":"TAXON_KEY", "value":"$1"}] }}"
http://api.gbif.org/v1/occurrence/download/request >> log.txt
echo -e "rn$1 $2rnrn----------------rnrn" >> log.txt
}
$ gbifapi 4140730 "Aciachne acicularis"
$ gbifapi 4140704 "Aciachne flagellifera"
$ gbifapi 5289784 "Aegilops comosa”
…
(work in progress…)
API example : asynchronous (2b)
(…clean log.txt with the downloadKeys using regular
expressions…)
function gbifwget {
echo -e "nn----------------n$1 $2 $3n" >> log_wget.txt
wget http://api.gbif.org/v1/occurrence/download/request/$1.zip 2>&1 | tee /
dev/tty >> log_wget.txt
mv $1.zip ./dwca/$2.zip 2>&1 | tee /dev/tty >> log_wget.txt
}
$ gbifwget 0006050-141024112412452 4140730 "Aciachne acicularis"
$ gbifwget 0006053-141024112412452 4140704 "Aciachne flagellifera"
$ gbifwget 0006056-141024112412452 5289784 "Aegilops comosa"
…
(work in progress…)
MAPPING API v1.0
You can easily overlay GBIF content on
your own maps.
http://www.gbif.org/developer/maps
Slide by Daniel Amariles, 2013
This	
  service	
  is	
  intended	
  for	
  use	
  with	
  commonly	
  used	
  map	
  clients	
  such	
  
as	
  the	
  Google	
  Maps	
  API,	
  Leaflet	
  JS	
  library	
  or	
  Modest	
  maps	
  JS	
  library.	
  	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
These	
  libraries	
  allow	
  the	
  GBIF	
  layers	
  to	
  be	
  visualized	
  with	
  other	
  
content,	
  such	
  as	
  those	
  coming	
  from	
  Web	
  Map	
  Service	
  (WMS)	
  providers.	
  
It	
  should	
  be	
  noted	
  that	
  the	
  mapping	
  API	
  is	
  not	
  a	
  WMS	
  service,	
  nor	
  does	
  
it	
  support	
  WFS	
  capabili)es.	
  	
  
hNp://leafletjs.com/	
  
MAPPING API v1.0
hNp://modestmaps.com/	
  	
  
Slide by Daniel Amariles, 2013
CUSTOMIZING LAYER CONTENT
The	
  format	
  of	
  the	
  URL	
  is	
  as	
  follows:	
  
	
  
	
  
	
  
	
  
	
  
With	
  the	
  following	
  required	
  parameters:	
  
	
  
type 	
  :	
  TAXON,	
  DATASET,	
  COUNTRY	
  or	
  PUBLISHER	
  
key 	
  :	
  The	
  appropriate	
  key	
  for	
  the	
  chosen	
  type	
  (a	
  taxon	
  key,	
  dataset/
publisher	
  UUID	
  or	
  2	
  leNer	
  ISO	
  country	
  code)	
  
	
  
Other	
  supported	
  parameters:	
  resolu)on,	
  layer,	
  paleNe,	
  colors,	
  satura)on,	
  
hue	
  
	
  
	
  	
  hNp://www.gbif.org/developer/maps	
  	
  
hNp://api.gbif.org/v1/map/density/)le?x={x}&y={y}&z={z}	
  
Slide by Daniel Amariles, 2013
Useful Tools (JSON & REST)
•  REST client …
•  JSON client/parser …
•  JSONView (Firefox, Chrome, …)
•  http://jsonview.com/
•  Display formatted JSON in browser
•  R CRAN : jsonlite
•  http://cran.r-project.org/web/packages/jsonlite/
•  E.g. read json into a dataframe [link]
•  OpenRefine
•  http://openrefine.org/
R CRAN
rOpenSci provides programmatic access to scientific data
with R (rgbif, taxize, EML, geonames, …).
https://github.com/ropensci
http://ropensci.org/packages/
http://ropensci.org/tutorials/rgbif_tutorial.html
http://ropensci.org/tutorials/taxize_tutorial.html
rOpenSci : rgbif
library(rgbif)
key <- name_backbone(name='Beta vulgaris', kingdom=‘Plantae')$speciesKey
bv <- occ_search(taxonKey=key, return='data', hasCoordinate=TRUE, limit=1000)
gbifmap(bv)
raster : WorldClim, BioClim layers
# using GBIF data (bv) from the previous slide…
library(raster)
xy <- cbind('lon'=bv$decimalLongitude, 'lat'=bv$decimalLatitude);
env <- getData('worldclim', var='bio', res=10) # bioclim (pkg raster)
plot(env, 1) # plot the first bioclim layer
points(xy[,'lon'], xy[,'lat'], col='red') # plot points
bio <- extract(env, xy); # extract environment to points (pkg raster)
bv_bio <- cbind(bv, bio); # column-bind GBIF-data and bioclim
rOpenSci : rWBclimate
library(rWBclimate, ggplot2)
country_dat <- get_historical_temp(c("NOR", "SWE", "DNK", "FIN"), "year")
ggplot(country_dat, aes(x = year, y = data, group = locator)) +
theme_bw(base_size=18) + geom_point() + geom_path() +
labs(y="Average annual temperature of Nordic countries", x="Year") +
stat_smooth(se = F, colour = "black") +
facet_wrap(~locator, scale = "free")
Resolve taxonomic names
library(taxize) # rOpenSci Taxize
gnr <- gnr_resolve(names = "Beta vuulgariss") # Misspelled name
gnr$results # display suggested names
submitted_name matched_name data_source_title score
1 Beta vuulgariss Beta vulgaris L. Catalogue of Life 0.75
2 Beta vuulgariss Beta vulgaris L. ITIS 0.75
3 Beta vuulgariss Beta vulgaris NCBI 0.75
4 Beta vuulgariss Beta vulgaris var.-gr. crassa Alef. GRIN Taxonomy for Plants 0.75
specieslist <- c("Beta vulgaris", "Phleum pratensis", "Nicotiana glauca")
classification(specieslist, db = 'itis') # lookup higher taxonomy
Global Names Resolver: http://resolver.globalnames.org/
rOpenSci Taxize: http://ropensci.org/tutorials/taxize_tutorial.html
db = ’col'
db = ’itis'
rOpenSci : EML
library(EML, rfigshare)
description <- "My dataset published in GBIF"
eml_write(dat = dat, meta, title = "My Dataset",
description = description, creator = "Your Name
<name@mail.net>", file = "dataset.xml")
eml_publish("dataset.xml", description = description,
categories = "Ecology", tags = "biodiversity", destination =
"figshare", visibility = "public")
meta <- eml_read("eml_example.xml")
GBIF API support
Subscribe to the mailing-list for help and
information messages:
api-users@lists.gbif.org
GBIF Hackathon March 2015
Naturalis, Leiden
GBIF portal API
Dag Endresen
GBIF Norway
UiO Natural History Museum in Oslo
University of Oslo
Tuesday, March 3rd, 2015
Slides: CC-BY-4.0

Contenu connexe

Tendances

Interoperability with netCDF-4 - Experience with NPP and HDF-EOS5 products
Interoperability with netCDF-4 - Experience with NPP and HDF-EOS5 productsInteroperability with netCDF-4 - Experience with NPP and HDF-EOS5 products
Interoperability with netCDF-4 - Experience with NPP and HDF-EOS5 products
The HDF-EOS Tools and Information Center
 

Tendances (20)

Interoperability with netCDF-4 - Experience with NPP and HDF-EOS5 products
Interoperability with netCDF-4 - Experience with NPP and HDF-EOS5 productsInteroperability with netCDF-4 - Experience with NPP and HDF-EOS5 products
Interoperability with netCDF-4 - Experience with NPP and HDF-EOS5 products
 
Product Designer Hub - Taking HPD to the Web
Product Designer Hub - Taking HPD to the WebProduct Designer Hub - Taking HPD to the Web
Product Designer Hub - Taking HPD to the Web
 
HDFEOS.org User Analsys, Updates, and Future
HDFEOS.org User Analsys, Updates, and FutureHDFEOS.org User Analsys, Updates, and Future
HDFEOS.org User Analsys, Updates, and Future
 
Latest Developments in H2O
Latest Developments in H2OLatest Developments in H2O
Latest Developments in H2O
 
HDF Product Designer: Using Templates to Achieve Interoperability
HDF Product Designer: Using Templates to Achieve InteroperabilityHDF Product Designer: Using Templates to Achieve Interoperability
HDF Product Designer: Using Templates to Achieve Interoperability
 
Tools to improve the usability of NASA HDF Data
Tools to improve the usability of NASA HDF DataTools to improve the usability of NASA HDF Data
Tools to improve the usability of NASA HDF Data
 
Hierarchical Data Formats (HDF) Update
Hierarchical Data Formats (HDF) UpdateHierarchical Data Formats (HDF) Update
Hierarchical Data Formats (HDF) Update
 
Introduction to Pig | Pig Architecture | Pig Fundamentals
Introduction to Pig | Pig Architecture | Pig FundamentalsIntroduction to Pig | Pig Architecture | Pig Fundamentals
Introduction to Pig | Pig Architecture | Pig Fundamentals
 
HDF Update for DAAC Managers (2017-02-27)
HDF Update for DAAC Managers (2017-02-27)HDF Update for DAAC Managers (2017-02-27)
HDF Update for DAAC Managers (2017-02-27)
 
One bridge to connect them all. Oracle GoldenGate for Big Data.UKOUG Tech 2018
One bridge to connect them all. Oracle GoldenGate for Big Data.UKOUG Tech 2018One bridge to connect them all. Oracle GoldenGate for Big Data.UKOUG Tech 2018
One bridge to connect them all. Oracle GoldenGate for Big Data.UKOUG Tech 2018
 
HDF Kita Lab: JupyterLab + HDF Service
HDF Kita Lab: JupyterLab + HDF ServiceHDF Kita Lab: JupyterLab + HDF Service
HDF Kita Lab: JupyterLab + HDF Service
 
HDF Update 2016
HDF Update 2016HDF Update 2016
HDF Update 2016
 
GDAL Enhancement for ESDIS Project
GDAL Enhancement for ESDIS ProjectGDAL Enhancement for ESDIS Project
GDAL Enhancement for ESDIS Project
 
Hdf5 parallel
Hdf5 parallelHdf5 parallel
Hdf5 parallel
 
Bridging ICESat and ICESat-2 Standard Data Products
Bridging ICESat and ICESat-2 Standard Data ProductsBridging ICESat and ICESat-2 Standard Data Products
Bridging ICESat and ICESat-2 Standard Data Products
 
Learning Apache HIVE - Data Warehouse and Query Language for Hadoop
Learning Apache HIVE - Data Warehouse and Query Language for HadoopLearning Apache HIVE - Data Warehouse and Query Language for Hadoop
Learning Apache HIVE - Data Warehouse and Query Language for Hadoop
 
HDF Product Designer
HDF Product DesignerHDF Product Designer
HDF Product Designer
 
Hadoop and other animals
Hadoop and other animalsHadoop and other animals
Hadoop and other animals
 
Incorporating ISO Metadata Using HDF Product Designer
Incorporating ISO Metadata Using HDF Product DesignerIncorporating ISO Metadata Using HDF Product Designer
Incorporating ISO Metadata Using HDF Product Designer
 
Efficiently serving HDF5 via OPeNDAP
Efficiently serving HDF5 via OPeNDAPEfficiently serving HDF5 via OPeNDAP
Efficiently serving HDF5 via OPeNDAP
 

Similaire à GBIF API Hackaton, March 2015, Leiden, Sp2000/GBIF

Streaming Visualization
Streaming VisualizationStreaming Visualization
Streaming Visualization
Guido Schmutz
 
Programming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E BayProgramming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E Bay
Phi Jack
 
Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08
Ari Leichtberg
 

Similaire à GBIF API Hackaton, March 2015, Leiden, Sp2000/GBIF (20)

Building applications with Serverless Framework and AWS Lambda
Building applications with Serverless Framework and AWS LambdaBuilding applications with Serverless Framework and AWS Lambda
Building applications with Serverless Framework and AWS Lambda
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needs
 
Microsoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needsMicrosoft Graph: Connect to essential data every app needs
Microsoft Graph: Connect to essential data every app needs
 
Building Tomorrow's Web Services
Building Tomorrow's Web ServicesBuilding Tomorrow's Web Services
Building Tomorrow's Web Services
 
Streaming Visualization
Streaming VisualizationStreaming Visualization
Streaming Visualization
 
Arabidopsis Information Portal overview from Plant Biology Europe 2014
Arabidopsis Information Portal overview from Plant Biology Europe 2014Arabidopsis Information Portal overview from Plant Biology Europe 2014
Arabidopsis Information Portal overview from Plant Biology Europe 2014
 
Inventoring Organizational ArcGIS Online Site Content Using FME
Inventoring Organizational ArcGIS Online Site Content Using FMEInventoring Organizational ArcGIS Online Site Content Using FME
Inventoring Organizational ArcGIS Online Site Content Using FME
 
Simple APIs for Spatial Data (OGC API - Features)
Simple APIs for Spatial Data (OGC API - Features)Simple APIs for Spatial Data (OGC API - Features)
Simple APIs for Spatial Data (OGC API - Features)
 
RICOH THETA x IoT Developers Contest : Cloud API Seminar (2nd installation)
RICOH THETA x IoT Developers Contest : Cloud API Seminar (2nd installation)RICOH THETA x IoT Developers Contest : Cloud API Seminar (2nd installation)
RICOH THETA x IoT Developers Contest : Cloud API Seminar (2nd installation)
 
High Availability by Design
High Availability by DesignHigh Availability by Design
High Availability by Design
 
Sprint 69
Sprint 69Sprint 69
Sprint 69
 
APIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be usedAPIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be used
 
Programming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E BayProgramming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E Bay
 
Arabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, IntroductionArabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, Introduction
 
CARTO ENGINE
CARTO ENGINECARTO ENGINE
CARTO ENGINE
 
Streaming Visualization
Streaming VisualizationStreaming Visualization
Streaming Visualization
 
Webdistilled API
Webdistilled APIWebdistilled API
Webdistilled API
 
OSFair2017 Workshop | EGI applications database
OSFair2017 Workshop | EGI applications databaseOSFair2017 Workshop | EGI applications database
OSFair2017 Workshop | EGI applications database
 
Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08
 
Deep Dive: Strategic Importance of BaaS
Deep Dive: Strategic Importance of BaaSDeep Dive: Strategic Importance of BaaS
Deep Dive: Strategic Importance of BaaS
 

Plus de Dag Endresen

Råd fra GBIF-Norge til datainfrastrukturutvalget i dialogmøte 2021-11-19
Råd fra GBIF-Norge til datainfrastrukturutvalget i dialogmøte 2021-11-19Råd fra GBIF-Norge til datainfrastrukturutvalget i dialogmøte 2021-11-19
Råd fra GBIF-Norge til datainfrastrukturutvalget i dialogmøte 2021-11-19
Dag Endresen
 

Plus de Dag Endresen (20)

Joint GBIF Biodiversa+ symposium in Helsinki on 2024-04-16
Joint GBIF Biodiversa+ symposium in  Helsinki on 2024-04-16Joint GBIF Biodiversa+ symposium in  Helsinki on 2024-04-16
Joint GBIF Biodiversa+ symposium in Helsinki on 2024-04-16
 
Iliad webinar 2024-03-13, Accessing and publishing marine biodiversity data i...
Iliad webinar 2024-03-13, Accessing and publishing marine biodiversity data i...Iliad webinar 2024-03-13, Accessing and publishing marine biodiversity data i...
Iliad webinar 2024-03-13, Accessing and publishing marine biodiversity data i...
 
Modelling Research Expeditions in Wikidata: Best Practice for Standardisation...
Modelling Research Expeditions in Wikidata: Best Practice for Standardisation...Modelling Research Expeditions in Wikidata: Best Practice for Standardisation...
Modelling Research Expeditions in Wikidata: Best Practice for Standardisation...
 
Ontologies for biodiversity informatics, UiO DSC June 2023
 Ontologies for biodiversity informatics, UiO DSC June 2023 Ontologies for biodiversity informatics, UiO DSC June 2023
Ontologies for biodiversity informatics, UiO DSC June 2023
 
Evacuation of the Kherson herbarium
Evacuation of the Kherson herbariumEvacuation of the Kherson herbarium
Evacuation of the Kherson herbarium
 
2023-05-08 GLIS SAC Rome
2023-05-08 GLIS SAC Rome2023-05-08 GLIS SAC Rome
2023-05-08 GLIS SAC Rome
 
BioDT for the UiO Science section meeting 2023-03-24
BioDT for the UiO Science section meeting 2023-03-24BioDT for the UiO Science section meeting 2023-03-24
BioDT for the UiO Science section meeting 2023-03-24
 
Data and Stats Forum at MINA NMBU - 2023-04-26
Data and Stats Forum at MINA NMBU - 2023-04-26Data and Stats Forum at MINA NMBU - 2023-04-26
Data and Stats Forum at MINA NMBU - 2023-04-26
 
BioDATA final conference in Oslo, November 2022
BioDATA final conference in Oslo, November 2022BioDATA final conference in Oslo, November 2022
BioDATA final conference in Oslo, November 2022
 
GBIF data mobilisation for the Nansen Legacy, Tromsø, 2022-09-20
GBIF data mobilisation for the Nansen Legacy, Tromsø, 2022-09-20GBIF data mobilisation for the Nansen Legacy, Tromsø, 2022-09-20
GBIF data mobilisation for the Nansen Legacy, Tromsø, 2022-09-20
 
GBIF at Living Norway Open Science Lab 2022-03-03
GBIF at Living Norway Open Science Lab 2022-03-03GBIF at Living Norway Open Science Lab 2022-03-03
GBIF at Living Norway Open Science Lab 2022-03-03
 
GBIF & GRScicoll, Høstseminar Norges museumsforbunds Seksjon for natur, 2021-...
GBIF & GRScicoll, Høstseminar Norges museumsforbunds Seksjon for natur, 2021-...GBIF & GRScicoll, Høstseminar Norges museumsforbunds Seksjon for natur, 2021-...
GBIF & GRScicoll, Høstseminar Norges museumsforbunds Seksjon for natur, 2021-...
 
Råd fra GBIF-Norge til datainfrastrukturutvalget i dialogmøte 2021-11-19
Råd fra GBIF-Norge til datainfrastrukturutvalget i dialogmøte 2021-11-19Råd fra GBIF-Norge til datainfrastrukturutvalget i dialogmøte 2021-11-19
Råd fra GBIF-Norge til datainfrastrukturutvalget i dialogmøte 2021-11-19
 
The role of biodiversity informatics in GBIF, 2021-05-18
The role of biodiversity informatics in GBIF, 2021-05-18The role of biodiversity informatics in GBIF, 2021-05-18
The role of biodiversity informatics in GBIF, 2021-05-18
 
GBIF and Biodiversity informatics for museums, 15 March 2021
GBIF and Biodiversity informatics for museums, 15 March 2021GBIF and Biodiversity informatics for museums, 15 March 2021
GBIF and Biodiversity informatics for museums, 15 March 2021
 
2016-10-12 MUSIT & GBIF - Dataset portals
2016-10-12 MUSIT & GBIF - Dataset portals2016-10-12 MUSIT & GBIF - Dataset portals
2016-10-12 MUSIT & GBIF - Dataset portals
 
2021-01-27--biodiversity-informatics-gbif-(52slides)
2021-01-27--biodiversity-informatics-gbif-(52slides)2021-01-27--biodiversity-informatics-gbif-(52slides)
2021-01-27--biodiversity-informatics-gbif-(52slides)
 
GBIF and Open Science
GBIF and Open ScienceGBIF and Open Science
GBIF and Open Science
 
FAIR and open biodiversity collection data management
FAIR and open biodiversity collection data managementFAIR and open biodiversity collection data management
FAIR and open biodiversity collection data management
 
BioDATA capacity enhancement curriculum at GBIF GB26 Global Nodes Meeting in ...
BioDATA capacity enhancement curriculum at GBIF GB26 Global Nodes Meeting in ...BioDATA capacity enhancement curriculum at GBIF GB26 Global Nodes Meeting in ...
BioDATA capacity enhancement curriculum at GBIF GB26 Global Nodes Meeting in ...
 

Dernier

Dernier (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

GBIF API Hackaton, March 2015, Leiden, Sp2000/GBIF

  • 1. GBIF & Species2000 Hackathon March 2015 Naturalis, Leiden GBIF portal API Dag Endresen GBIF Norway UiO Natural History Museum in Oslo University of Oslo Tuesday, March 3rd, 2015 Slides: CC-BY-4.0
  • 2. Credits, some slides from: Daniel Amariles, Colombia (2013) Nodes training at GBIF GB20 in Berlin [link] Gallien Labeyrie, France (2014) Mentoring project France-Spain-Portugal [link]
  • 5. GBIF DATA PORTAL API   An interface to access data published through the GBIF network using web services.  
  • 6. DATA PORTAL API GBIF Data Portal API: http://api.gbif.org/v1/ (+parameters) Summary and information: http://www.gbif.org/developer/summary The RESTful API take search parameters as key=value pairs and respond with json content type. RESTful query format JSON response type
  • 7. GBIF API sections   •  Registry     informa)on  about  the  datasets,  organiza)ons  (e.g.  data  publishers),   networks  and  the  means  to  access  them  (technical  endpoints)   •  Species   informa)on  about  species  and  higher  taxa,  and  u)lity  services  for   interpre)ng  names  and  looking  up  the  iden)fiers  (access  to  all  published   checklists  in  the  GBIF  checklist  bank)   •  Occurrence   occurrence  informa)on  crawled  and  indexed  by  GBIF  and  search  services   to  do  real  )me  paged  search  and  asynchronous  download  services  to  do   large  batch  downloads   •  Maps   simple  services  to  show  the  maps  of  GBIF  mobilized  content   •  News   services  to  stream  useful  informa)on  (RSS)  
  • 8. API example : dataset Search for datasets by publishing country: http://api.gbif.org/v1/dataset/search?publishingCountry=NO Dataset information (UiO NHM Lichens): http://api.gbif.org/v1/dataset/7948250c-6958-4a29-a670- ed1015b26252 Contact persons for a dataset: http://api.gbif.org/v1/dataset/7948250c-6958-4a29-a670- ed1015b26252/contact Dataset endpoint (get download URL): http://api.gbif.org/v1/dataset/7948250c-6958-4a29-a670- ed1015b26252/endpoint http://www.gbif.org/developer/registry
  • 9. API example : dataset Download activity metrics for dataset (UiO NHM Lichens): http://api.gbif.org/v1/occurrence/download/dataset/ 7948250c-6958-4a29-a670-ed1015b26252 => records from this dataset, included in 2650 download sets Records lastInterpreted since November 2014: http://api.gbif.org/v1/occurrence/search? datasetKey=7948250c-6958-4a29-a670- ed1015b26252&lastInterpreted=2014-11-01,* (=> 168 316 occ.) Metrics for dataset data contents: http://api.gbif.org/v1/dataset/66dd0960-2d7d-46ee- a491-87b9adcfe7b1/metrics => count records by dimensions such as Kingdom, Rank, Vernacular name langue, Extensions provided, … NB! only implemented for species checklists, not (yet?) for occurrences! http://www.gbif.org/developer/registry
  • 10. API example : species List all name usages (across all checklists): http://api.gbif.org/v1/species?name=Beta%20vulgaris Name usage across checklists (Beta vulgaris, 5383920): http://api.gbif.org/v1/species/5383920/related Name parsed into epithets and author etc.: http://api.gbif.org/v1/parser/name?name=Abies%20alba %20Mill.%20sec.%20Markus%20D. {"scientificName": "Abies alba Mill. sec. Markus D.", "type": "SCINAME", "genusOrAbove": "Abies", "specificEpithet": "alba", "authorsParsed": true, "authorship": "Mill.", "sensu": "sec. Markus D.", "canonicalName": "Abies alba", "canonicalNameWithMarker": "Abies alba", "canonicalNameComplete": "Abies alba Mill." } http://www.gbif.org/developer/species
  • 11. API example : occurrence List occurrences of Beta vulgaris: http://api.gbif.org/v1/species/match?name=Beta+vulgaris => taxonKey http://api.gbif.org/v1/occurrence/search?taxonKey=5383920 List occurrences from Norway (of Beta vulgaris): http://api.gbif.org/v1/occurrence/search?publishingCountry=NO http://api.gbif.org/v1/occurrence/search?publishingCountry=NO&taxonKey=5383920 Information about a single occurrence record: http://api.gbif.org/v1/occurrence/1040970640 http://api.gbif.org/v1/occurrence/1040970640/fragment http://api.gbif.org/v1/occurrence/1040970640/verbatim List occurrence counts for datasets of country (or taxon): http://api.gbif.org/v1/occurrence/counts/datasets?country=NO http://www.gbif.org/developer/occurrence
  • 12. API example : identifiers (not implemented -- yet) Searching by occurrenceID is unfortunately not supported yet … http://dev.gbif.org/issues/browse/POR-2451 http://dev.gbif.org/issues/browse/POR-2337 So, we cannot yet list or count occurrences with pattern “urn*” in occurrenceID http://api.gbif.org/v1/occurrence/search?occurrenceID=urn* http://api.gbif.org/v1/occurrence/search?occurrenceID=urn%3Acatalog http://api.gbif.org/v1/occurrence/search?occurrenceID=urn%3Alsid http://api.gbif.org/v1/occurrence/search?occurrenceID=http* …
  • 13. API example : download data Lookup speciesKey (1) and download occurrences (2): http://api.gbif.org/v1/species/match? verbose=false&kingdom=Plantae&name=Beta+vulgaris => usageKey/speciesKey = 5383920 http://api.gbif.org/v1/occurrence/search? taxonKey=5383920 [&limit=1000&offset=0] => notice: count = 25 513 => then: page through results… (using offset & limit) http://api.gbif.org/v1/occurrence/download/request [POST] => downloadKey (see next slide)
  • 14. API example : asynchronous (1) Request asynchronous download: $ curl -i --user yourGbifUserName:yourGbifPassord -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @filter.json http://api.gbif.org/v1//occurrence/ download/request >> log.txt Search parameters in a json text file: filter.json (in current directory or located in a “PATH-directory”): { "creator":”yourGbifUserName", "notification_address": [“yourEmail@mail.net"], "predicate": { "type":"and", "predicates": [{"type":"equals","key":"HAS_COORDINATE","value":"false"}, {"type":"equals","key":"TAXON_KEY","value":"5383920"}] } }
  • 15. Downloads are available in the portal (from your user profile)
  • 16. API example : asynchronous (2a) Request asynchronous download: function gbifapi { curl -i –user yourGbifUserName:yourGbifPassword -H "Content-Type: application/ json" -H "Accept: application/json" -X POST -d "{"creator":”yourGbifUserName ", "notification_address": [”yourEmail@mail.net"], "predicate": {"type": "and", "predicates": [{"type":"equals","key":"HAS_COORDINATE","value ":"true"}, {"type":"equals", "key":"TAXON_KEY", "value":"$1"}] }}" http://api.gbif.org/v1/occurrence/download/request >> log.txt echo -e "rn$1 $2rnrn----------------rnrn" >> log.txt } $ gbifapi 4140730 "Aciachne acicularis" $ gbifapi 4140704 "Aciachne flagellifera" $ gbifapi 5289784 "Aegilops comosa” … (work in progress…)
  • 17. API example : asynchronous (2b) (…clean log.txt with the downloadKeys using regular expressions…) function gbifwget { echo -e "nn----------------n$1 $2 $3n" >> log_wget.txt wget http://api.gbif.org/v1/occurrence/download/request/$1.zip 2>&1 | tee / dev/tty >> log_wget.txt mv $1.zip ./dwca/$2.zip 2>&1 | tee /dev/tty >> log_wget.txt } $ gbifwget 0006050-141024112412452 4140730 "Aciachne acicularis" $ gbifwget 0006053-141024112412452 4140704 "Aciachne flagellifera" $ gbifwget 0006056-141024112412452 5289784 "Aegilops comosa" … (work in progress…)
  • 18. MAPPING API v1.0 You can easily overlay GBIF content on your own maps. http://www.gbif.org/developer/maps Slide by Daniel Amariles, 2013
  • 19. This  service  is  intended  for  use  with  commonly  used  map  clients  such   as  the  Google  Maps  API,  Leaflet  JS  library  or  Modest  maps  JS  library.                           These  libraries  allow  the  GBIF  layers  to  be  visualized  with  other   content,  such  as  those  coming  from  Web  Map  Service  (WMS)  providers.   It  should  be  noted  that  the  mapping  API  is  not  a  WMS  service,  nor  does   it  support  WFS  capabili)es.     hNp://leafletjs.com/   MAPPING API v1.0 hNp://modestmaps.com/     Slide by Daniel Amariles, 2013
  • 20. CUSTOMIZING LAYER CONTENT The  format  of  the  URL  is  as  follows:             With  the  following  required  parameters:     type  :  TAXON,  DATASET,  COUNTRY  or  PUBLISHER   key  :  The  appropriate  key  for  the  chosen  type  (a  taxon  key,  dataset/ publisher  UUID  or  2  leNer  ISO  country  code)     Other  supported  parameters:  resolu)on,  layer,  paleNe,  colors,  satura)on,   hue        hNp://www.gbif.org/developer/maps     hNp://api.gbif.org/v1/map/density/)le?x={x}&y={y}&z={z}   Slide by Daniel Amariles, 2013
  • 21. Useful Tools (JSON & REST) •  REST client … •  JSON client/parser … •  JSONView (Firefox, Chrome, …) •  http://jsonview.com/ •  Display formatted JSON in browser •  R CRAN : jsonlite •  http://cran.r-project.org/web/packages/jsonlite/ •  E.g. read json into a dataframe [link] •  OpenRefine •  http://openrefine.org/
  • 22.
  • 23. R CRAN rOpenSci provides programmatic access to scientific data with R (rgbif, taxize, EML, geonames, …). https://github.com/ropensci http://ropensci.org/packages/ http://ropensci.org/tutorials/rgbif_tutorial.html http://ropensci.org/tutorials/taxize_tutorial.html
  • 24. rOpenSci : rgbif library(rgbif) key <- name_backbone(name='Beta vulgaris', kingdom=‘Plantae')$speciesKey bv <- occ_search(taxonKey=key, return='data', hasCoordinate=TRUE, limit=1000) gbifmap(bv)
  • 25. raster : WorldClim, BioClim layers # using GBIF data (bv) from the previous slide… library(raster) xy <- cbind('lon'=bv$decimalLongitude, 'lat'=bv$decimalLatitude); env <- getData('worldclim', var='bio', res=10) # bioclim (pkg raster) plot(env, 1) # plot the first bioclim layer points(xy[,'lon'], xy[,'lat'], col='red') # plot points bio <- extract(env, xy); # extract environment to points (pkg raster) bv_bio <- cbind(bv, bio); # column-bind GBIF-data and bioclim
  • 26. rOpenSci : rWBclimate library(rWBclimate, ggplot2) country_dat <- get_historical_temp(c("NOR", "SWE", "DNK", "FIN"), "year") ggplot(country_dat, aes(x = year, y = data, group = locator)) + theme_bw(base_size=18) + geom_point() + geom_path() + labs(y="Average annual temperature of Nordic countries", x="Year") + stat_smooth(se = F, colour = "black") + facet_wrap(~locator, scale = "free")
  • 27. Resolve taxonomic names library(taxize) # rOpenSci Taxize gnr <- gnr_resolve(names = "Beta vuulgariss") # Misspelled name gnr$results # display suggested names submitted_name matched_name data_source_title score 1 Beta vuulgariss Beta vulgaris L. Catalogue of Life 0.75 2 Beta vuulgariss Beta vulgaris L. ITIS 0.75 3 Beta vuulgariss Beta vulgaris NCBI 0.75 4 Beta vuulgariss Beta vulgaris var.-gr. crassa Alef. GRIN Taxonomy for Plants 0.75 specieslist <- c("Beta vulgaris", "Phleum pratensis", "Nicotiana glauca") classification(specieslist, db = 'itis') # lookup higher taxonomy Global Names Resolver: http://resolver.globalnames.org/ rOpenSci Taxize: http://ropensci.org/tutorials/taxize_tutorial.html db = ’col' db = ’itis'
  • 28. rOpenSci : EML library(EML, rfigshare) description <- "My dataset published in GBIF" eml_write(dat = dat, meta, title = "My Dataset", description = description, creator = "Your Name <name@mail.net>", file = "dataset.xml") eml_publish("dataset.xml", description = description, categories = "Ecology", tags = "biodiversity", destination = "figshare", visibility = "public") meta <- eml_read("eml_example.xml")
  • 29. GBIF API support Subscribe to the mailing-list for help and information messages: api-users@lists.gbif.org
  • 30. GBIF Hackathon March 2015 Naturalis, Leiden GBIF portal API Dag Endresen GBIF Norway UiO Natural History Museum in Oslo University of Oslo Tuesday, March 3rd, 2015 Slides: CC-BY-4.0