q – [str] Simple search parameter. The value for this parameter can be a simple word or a phrase.

spellCheck – [bool] If True ask GBIF to check your spelling of the value passed to the search parameter.
IMPORTANT: This only checks the input to the search parameter, and no others. Default: False

repatriated – [str] Searches for records whose publishing country is different to the country where the record was recorded in

kingdomKey – [int] Kingdom classification key

phylumKey – [int] Phylum classification key

classKey – [int] Class classification key

orderKey – [int] Order classification key

familyKey – [int] Family classification key

genusKey – [int] Genus classification key

subgenusKey – [int] Subgenus classification key

scientificName – [str] A scientific name from the GBIF backbone. All included and synonym taxa are included in the search.

datasetKey – [str] The occurrence dataset key (a uuid)

catalogNumber – [str] An identifier of any form assigned by the source within a physical collection or digital dataset for the record which may not unique, but should be fairly unique in combination with the institution and collection code.

recordedBy – [str] The person who recorded the occurrence.

collectionCode – [str] An identifier of any form assigned by the source to identify the physical collection or digital dataset uniquely within the text of an institution.

institutionCode – [str] An identifier of any form assigned by the source to identify the institution the record belongs to. Not guaranteed to be que.

geometry – [str] Searches for occurrences inside a polygon described in Well Known
Text (WKT) format. A WKT shape written as either POINT, LINESTRING, LINEARRING
POLYGON, or MULTIPOLYGON. Example of a polygon: ((30.110.1,20,2040,4040,30.110.1)) would be queried as http://bit.ly/1BzNwDq.

hasGeospatialIssue – [bool] Includes/excludes occurrence records which contain spatial
issues (as determined in our record interpretation), i.e. hasGeospatialIssue=TRUE
returns only those records with spatial issues while hasGeospatialIssue=FALSE includes
only records without spatial issues. The absence of this parameter returns any
record with or without spatial issues.

issue – [str] One or more of many possible issues with each occurrence record. See
Details. Issues passed to this parameter filter results by the issue.

continent – [str] Continent. One of africa, antarctica, asia, europe, north_america
(North America includes the Caribbean and reachies down and includes Panama), oceania,
or south_america

fields – [str] Default (all) returns all fields. minimal returns just taxon name,
key, latitude, and longitude. Or specify each field you want returned by name, e.g.
fields=c('name','latitude','elevation').

facetMincount – [int] minimum number of records to be included in the faceting results

facetMultiselect – [bool] Set to true to still return counts for values that are not currently
filtered. See examples. Default: false

Returns:

A dictionary, of results

Usage:

frompygbifimportoccurrencesoccurrences.search(taxonKey=3329049)# Return 2 results, this is the default by the wayoccurrences.search(taxonKey=3329049,limit=2)# Instead of getting a taxon key first, you can search for a name directly## However, note that using this approach (with \code{scientificName="..."})## you are getting synonyms too. The results for using \code{scientifcName} and## \code{taxonKey} parameters are the same in this case, but I wouldn't be surprised if for some## names they return different resultsoccurrences.search(scientificName='Ursus americanus')frompygbifimportspecieskey=species.name_backbone(name='Ursus americanus',rank='species')['usageKey']occurrences.search(taxonKey=key)# Search by dataset keyoccurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a',limit=20)# Search by catalog numberoccurrences.search(catalogNumber="49366",limit=20)# occurrences.search(catalogNumber=["49366","Bird.27847588"], limit=20)# Use paging parameters (limit and offset) to page. Note the different results# for the two queries below.occurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a',offset=10,limit=5)occurrences.search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a',offset=20,limit=5)# Many dataset keys# occurrences.search(datasetKey=["50c9509d-22c7-4a22-a47d-8c48425ef4a7", "7b5d6a48-f762-11e1-a439-00145eb45e9a"], limit=20)# Search by collector nameres=occurrences.search(recordedBy="smith",limit=20)[x['recordedBy']forxinres['results']]# Many collector names# occurrences.search(recordedBy=["smith","BJ Stacey"], limit=20)# Search for many speciessplist=['Cyanocitta stelleri','Junco hyemalis','Aix sponsa']keys=[species.name_suggest(x)[0]['key']forxinsplist]out=[occurrences.search(taxonKey=x,limit=1)forxinkeys][x['results'][0]['speciesKey']forxinout]# Search - q parameteroccurrences.search(q="kingfisher",limit=20)## spell check - only works with the `search` parameter### spelled correctly - same result as above calloccurrences.search(q="kingfisher",limit=20,spellCheck=True)### spelled incorrectly - stops with suggested spellingoccurrences.search(q="kajsdkla",limit=20,spellCheck=True)### spelled incorrectly - stops with many suggested spellings### and number of results for eachoccurrences.search(q="helir",limit=20,spellCheck=True)# Search on latitidue and longitudeoccurrences.search(decimalLatitude=50,decimalLongitude=10,limit=2)# Search on a bounding box## in well known text formatoccurrences.search(geometry='POLYGON((30.1 10.1, 10 20, 20 40, 40 40, 30.1 10.1))',limit=20)frompygbifimportspecieskey=species.name_suggest(q='Aesculus hippocastanum')[0]['key']occurrences.search(taxonKey=key,geometry='POLYGON((30.1 10.1, 10 20, 20 40, 40 40, 30.1 10.1))',limit=20)## multipolygonwkt='MULTIPOLYGON(((-123 38, -123 43, -116 43, -116 38, -123 38)),((-97 41, -97 45, -93 45, -93 41, -97 41)))'occurrences.search(geometry=wkt,limit=20)# Search on countryoccurrences.search(country='US',limit=20)occurrences.search(country='FR',limit=20)occurrences.search(country='DE',limit=20)# Get only occurrences with lat/long dataoccurrences.search(taxonKey=key,hasCoordinate=True,limit=20)# Get only occurrences that were recorded as living specimensoccurrences.search(taxonKey=key,basisOfRecord="LIVING_SPECIMEN",hasCoordinate=True,limit=20)# Get occurrences for a particular eventDateoccurrences.search(taxonKey=key,eventDate="2013",limit=20)occurrences.search(taxonKey=key,year="2013",limit=20)occurrences.search(taxonKey=key,month="6",limit=20)# Get occurrences based on depthkey=species.name_backbone(name='Salmo salar',kingdom='animals')['usageKey']occurrences.search(taxonKey=key,depth="5",limit=20)# Get occurrences based on elevationkey=species.name_backbone(name='Puma concolor',kingdom='animals')['usageKey']occurrences.search(taxonKey=key,elevation=50,hasCoordinate=True,limit=20)# Get occurrences based on institutionCodeoccurrences.search(institutionCode="TLMF",limit=20)# Get occurrences based on collectionCodeoccurrences.search(collectionCode="Floristic Databases MV - Higher Plants",limit=20)# Get only those occurrences with spatial issuesoccurrences.search(taxonKey=key,hasGeospatialIssue=True,limit=20)# Search using a query stringoccurrences.search(q="kingfisher",limit=20)# Range queries## See Detail for parameters that support range queries### this is a range depth, with lower/upper limits in character stringoccurrences.search(depth='50,100')## Range search with yearoccurrences.search(year='1999,2000',limit=20)## Range search with latitudeoccurrences.search(decimalLatitude='29.59,29.6')# Search by specimen type status## Look for possible values of the typeStatus parameter looking at the typestatus datasetoccurrences.search(typeStatus='allotype')# Search by specimen record number## This is the record number of the person/group that submitted the data, not GBIF's numbers## You can see that many different groups have record number 1, so not super helpfuloccurrences.search(recordNumber=1)# Search by last time interpreted: Date the record was last modified in GBIF## The lastInterpreted parameter accepts ISO 8601 format dates, including## yyyy, yyyy-MM, yyyy-MM-dd, or MM-dd. Range queries are accepted for lastInterpretedoccurrences.search(lastInterpreted='2014-04-01')# Search by continent## One of africa, antarctica, asia, europe, north_america, oceania, or south_americaoccurrences.search(continent='south_america')occurrences.search(continent='africa')occurrences.search(continent='oceania')occurrences.search(continent='antarctica')# Search for occurrences with imagesoccurrences.search(mediatype='StillImage')occurrences.search(mediatype='MovingImage')x=occurrences.search(mediatype='Sound')[z['media']forzinx['results']]# Query based on issuesoccurrences.search(taxonKey=1,issue='DEPTH_UNLIKELY')occurrences.search(taxonKey=1,issue=['DEPTH_UNLIKELY','COORDINATE_ROUNDED'])# Show all records in the Arizona State Lichen Collection that cant be matched to the GBIF# backbone properly:occurrences.search(datasetKey='84c0e1a0-f762-11e1-a439-00145eb45e9a',issue=['TAXON_MATCH_NONE','TAXON_MATCH_HIGHERRANK'])# If you pass in an invalid polygon you get hopefully informative errors### the WKT string is fine, but GBIF says bad polygonwkt='POLYGON((-178.59375 64.83258989321493,-165.9375 59.24622380205539,-147.304687559.065977905449806,-130.7812551.04484764446178,-125.85937536.70806354647625,-112.148437523.367471303759686,-105.117187516.093320185359257,-86.83593759.23767076398516,-82.968752.9485268155066175,-82.6171875-14.812060061226388,-74.8828125-18.849111862023985,-77.34375-47.661687803329166,-84.375-49.975955187343295,174.7265625-50.649460483096114,179.296875-42.19189902447192,-176.8359375-35.634976650677295,176.8359375-31.835565983656227,163.4765625-6.528187613695323,152.5781251.894796132058301,135.7031254.702353722559447,127.9687515.077427674847987,127.9687523.689804541429606,139.92187532.06861069132688,149.414062542.65416193033991,159.257812548.3160811030533,168.398437557.019804336633165,178.242187559.95776046458139,-179.648437561.16708631440347,-178.5937564.83258989321493))'occurrences.search(geometry=wkt)# Faceting## return no occurrence records with limit=0x=occurrences.search(facet="country",limit=0)x['facets']## also return occurrence recordsx=occurrences.search(facet="establishmentMeans",limit=10)x['facets']x['results']## multiple facet variablesx=occurrences.search(facet=["country","basisOfRecord"],limit=10)x['results']x['facets']x['facets']['country']x['facets']['basisOfRecord']x['facets']['basisOfRecord']['count']## set a minimum facet countx=occurrences.search(facet="country",facetMincount=30000000L,limit=0)x['facets']## paging per each faceted variable### do so by passing in variables like "country" + "_facetLimit" = "country_facetLimit"### or "country" + "_facetOffset" = "country_facetOffset"x=occurrences.search(facet=["country","basisOfRecord","hasCoordinate"],country_facetLimit=3,basisOfRecord_facetLimit=6,limit=0)x['facets']# requests package options## There's an acceptable set of requests options (['timeout', 'cookies', 'auth',## 'allow_redirects', 'proxies', 'verify', 'stream', 'cert']) you can pass## in via **kwargs, e.g., set a timeoutx=occurrences.search(timeout=1)

Argument passed have to be passed as character (e.g., country=US),
with a space between key (country), operator (=), and value (US).
See the type parameter for possible options for the operator.
This character string is parsed internally.

Downloads the zip file to a directory you specify on your machine.
The speed of this function is of course proportional to the size of the
file to download, and affected by your internet connection speed.