Angular service
BiocacheService source
Description
Methods to interact with ALA biocache-service
Methods
-
bbox (query) -> Promise(List)
-
Get query longitude and latitude bounding box
Example
Input: - query { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } Output: [[-180, -90], [180, 90]]Parameters
Name Type Description query Query Biocache query
Returns
Type Description Promise(List) southWest corner and northEast corner as decimal latitude and longitude
-
constructSearchResultUrl (query, fqs, pageSize, offset, facet) -> Promise(String)
-
General search query URL
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Output: "http://biocache-ws.ala.org.au/ws/occurrences/search?q=Macropus&fq=geospatial_kosher:true&pageSize=1&offset=0&facet=false"Parameters
Name Type Description query Query Biocache query
fqs List (Optional) additional fq terms
pageSize Integer (Optional) page size (default=1)
offset Integer (Optional) offset (default=0)
facet Boolean (Optional) include server default facets (default=false)
Returns
Type Description Promise(String) search URL
-
count (query, fqs) -> Promise(Integer)
-
Get number of occurrences
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Output: 500Returns
Type Description Promise(Integer) number of occurrences
-
dataProviderList (query, fqs) -> Promise(List)
-
List data providers
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Output: []Returns
Type Description Promise(List) List of data proviers
-
facet (facet, query) -> Promise(List)
-
Get facet list
Example
Input: - facet "taxon_name" - query { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } Output: [{ "name": "Macropus giganteus", "count": 70654, "colour": 0, "fq": "taxon_name:\"Macropus giganteus\"", "red": 51, "blue": 204, "green": 102, "displayname": "Macropus giganteus" }, { "name": "Osphranter rufus", "count": 47542, "colour": 0, "fq": "taxon_name:\"Osphranter rufus\"", "red": 220, "blue": 18, "green": 57 }]Parameters
Name Type Description facet String Facet name
query Query Biocache query
Returns
Type Description Promise(List) facets
-
facetGeneral (facet, query, pageSize, offset, prefixFilter, sortBy, config) -> Promise(List)
-
Get pageable facet list
Example
Input: - facet "taxon_name" - query { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } Output: [{ "fieldName": "taxon_name", "fieldResult": [{ "label": "Macropus giganteus", "count": 70654, "fq": "taxon_name:\"Macropus giganteus\"", "displaylabel": "Macropus giganteus" }, { "label": "Osphranter rufus", "count": 47542, "fq": "taxon_name:\"Osphranter rufus\"", "displaylabel": "Osphranter rufus" }] }]Parameters
Name Type Description facet String Facet name
query Query Biocache query
pageSize Integer (Optional) page size (default=1)
offset Integer (Optional) offset (default=0)
prefixFilter String (Optional) keywords
sortBy String (Optional) sorted by field (default=count)
config List (Optional) parameters for $http#get
Returns
Type Description Promise(List) facets
-
joinAndEncode (list) -> String
-
Encode and join a list of q and fq terms
Parameters
Name Type Description list List q and fqs
Returns
Type Description String query parameters as a string
-
newLayer (query, area, name) -> Promise(Layer)
-
Create a new #Layer suitable for adding to #MapService
Example
Input: - q ["taxon_name:Macropus"] Output: { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au", "name": "" }Parameters
Name Type Description query List q and fq terms
area Area (optional) area to limit the query
name newName (optional) name for display
Returns
Type Description Promise(Layer)
-
newLayerAddFq (query, fq, name) -> Promise(Layer)
-
Create a new query #Layer
Example
Input: - q ["taxon_name:Macropus"] Output: { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au", "name": "" }Parameters
Name Type Description query List q and fq terms
fq String (optional) one fq term
name newName (optional) name for display
Returns
Type Description Promise(Layer)
-
newQuery (query, name, wkt) -> Query
-
Create a new #Query
Example
Input: - q ["taxon_name:Macropus"] Output: { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au", "name": "" }Parameters
Name Type Description query List q and fq terms
name name (optional) name for display
wkt String (optional) WKT search value
Returns
Type Description Query
-
queryTitle (query, fqs) -> Promise(String)
-
Get the default query title
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Output: "<span>Macropus</span>"Returns
Type Description Promise(String) formatted biocache-service query title
-
registerLayer (wsUrl, hubUrl, fqs, wkt, qualityProfile, disableQualityFilter, disableAllQualityFilters, name) -> Promise(Layer)
-
Create a layer and register for qid
Example
Input: - bs "https://biocache-ws.ala.org.au/ws" - ws "https://biocache.ala.org.au" - fq ["taxon_name:Macropus"] Output: { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au", "name": "" }Parameters
Name Type Description wsUrl String biocache-service URL
hubUrl String biocache-hub URL
fqs List q and fq terms
wkt String (optional) WKT
qualityProfile String (optional) quality profile
disableQualityFilter Array (optional) quality filters to disable
disableAllQualityFilters Boolean (optional) whether to disable all quality filters
name newName (optional) name for display
Returns
Type Description Promise(Layer)
-
registerParam (url, query, fq, wkt, qualityProfile, disableQualityFilter, disableAllQualityFilters) -> Promise(Integer)
-
Get qid for a query
Example
Input: - bs "https://biocache-ws.ala.org.au/ws" - q ["taxon_name:Macropus"] Output: 1234Parameters
Name Type Description url String biocache-service URL
query List q and fq terms
fq List (optional) one fq term
wkt String (optional) WKT search value
qualityProfile String (optional) quality profile
disableQualityFilter Array (optional) quality filters to disable
disableAllQualityFilters Boolean (optional) whether to disable all quality filters
Returns
Type Description Promise(Integer) qid
-
registerQuery (query) -> Promise(Query)
-
Shorten a query
Example
Input: - query { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } Output: { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au", "qid": 1234 }Parameters
Name Type Description query Query Biocache query
Returns
Type Description Promise(Query) qid
-
searchForOccurrences (query, fqs, pageSize, offset, facet) -> Promise(Map)
-
Get search query output
Example
Input: - query { "q": ["taxon_name:Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - pageSize 0 Output: { "pageSize": 0, "startIndex": 0, "totalRecords": 736, "sort": "score", "dir": "asc", "status": "OK", "occurrences": [], "facetResults": [], "query": "?q=taxon_name%3AMacropus", "urlParameters": "?q=taxon_name%3AMacropus", "queryTitle": "Scientific name:Macropus", "activeFacetMap": {} }Parameters
Name Type Description query Query Biocache query
fqs List (Optional) additional fq terms
pageSize Integer (Optional) page size (default=1)
offset Integer (Optional) offset (default=0)
facet Boolean (Optional) include server default facets (default=false)
Returns
Type Description Promise(Map) search results
-
speciesCount (query, fqs) -> Promise(Integer)
-
Get the number of unique species (by facet names_and_lsid)
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Ouput: 10Returns
Type Description Promise(Integer) Number of unique species
-
speciesCountEndemic (query, fqs) -> Promise(Integer)
-
Get the number of unique endemic species (by facet names_and_lsid)
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Ouput: 2Returns
Type Description Promise(Integer) Number of unique endemic species
-
speciesList (query, fqs, config) -> Promise(String)
-
Get species list CSV
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] - config Ouput: "names_and_lsid","Species Name","Scientific Name Authorship","Taxon Rank","Kingdom","Phylum","Class","Order","Family","Genus","Vernacular Name","Number of records","Conservation","Invasive" "Macropus giganteus|urn:lsid:biodiversity.org.au:afd.taxon:23f4784e-1116-482c-8e3e-b6b12733f588|Eastern Grey Kangaroo|Animalia|Macropodidae","Macropus giganteus","Shaw, 1790","species","ANIMALIA","CHORDATA","MAMMALIA","DIPROTODONTIA","MACROPODIDAE","Macropus","Eastern Grey Kangaroo","70654","South Australia : Conservation Status","" "Osphranter rufus|urn:lsid:biodiversity.org.au:afd.taxon:e6aff6af-ff36-4ad5-95f2-2dfdcca8caff|Red Kangaroo|Animalia|Macropodidae","Osphranter rufus","(Desmarest, 1822)","species","ANIMALIA","CHORDATA","MAMMALIA","DIPROTODONTIA","MACROPODIDAE","Osphranter","Red Kangaroo","47542","Northern Territory : Conservation Status",""Parameters
Name Type Description query Query Biocache query
fqs List (Optional) additional fq terms
config Map (Optional) parameters for $http#get
Returns
Type Description Promise(String) Species list CSV
-
speciesListEndemic (query, fqs) -> Promise(String)
-
Get the endemic species list as CSV
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Output: ``` names_and_lsid Species Name Scientific Name Authorship Taxon Rank Kingdom Phylum Class Order Family Genus Vernacular Name Number of records Notamacropus agilis agilis|urn:lsid:biodiversity.org.au:afd.taxon:471127b3-a2c1-430e-931d-938cce4e58e8||Animalia|Macropodidae" Notamacropus agilis agilis (Gould, 1842) subspecies ANIMALIA CHORDATA MAMMALIA DIPROTODONTIA MACROPODIDAE Notamacropus 130 Notamacropus agilis jardinii|urn:lsid:biodiversity.org.au:afd.taxon:bfe816bf-2b7e-47cb-87f8-ac386af751ab||Animalia|Macropodidae" Notamacropus agilis jardinii (De Vis, 1884) subspecies ANIMALIA CHORDATA MAMMALIA DIPROTODONTIA MACROPODIDAE Notamacropus 451 ```Returns
Type Description Promise(String) CSV of endemic species list
-
speciesListEndemicUrl (query, fqs) -> Promise(String)
-
Build URL to GET endemic species list CSV
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Output: "http://biocache.ala.org.au/ws/explore/endemic/species/1234.csv?facets=names_and_lsid&lookup=true&count=true&lists=true"Returns
Type Description Promise(String) GET URL to endemic species list CSV
-
speciesListUrl (query, fqs) -> Promise(String)
-
Build URL to GET species list CSV
Example
Input: - query { "q": ["Macropus"], "bs": "https://biocache-ws.ala.org.au/ws", "ws": "https://biocache.ala.org.au" } - fqs ["geospatial_kosher:true"] Output: "https://biocache-ws.ala.org.au/ws/occurrences/facets/download?facets=names_and_lsid&lookup=true&count=true&lists=true&q=Macropus&fq=geospatial_kosher:true"Returns
Type Description Promise(String) GET URL to species list CSV