OccurrenceMap

Constructor

new OccurrenceMap(id, biocacheBaseUrl, queryString, options)

Object for interacting with an ALA Occurrence map. This map is designed for displaying ALA occurrence records, with the ability for users to control the query facets behind the data.

The resulting query can be extracted and saved for later re-use.

The query is used to interact with a biocache instance (the client must provide the base URL for the biocache). Some additional parameters are stored in the query string and used to control the appearance of the map (e.g. colour by options, which are not part of the query itself but are used to colour the results).

Options

  • mapOptions Object containing configuration options for the underlying map. See ALA.Map for details. If not provided, the defaults from ALA.Map will be used.
  • showFacets True to allow the user to change the facets used for the query. Default: true
  • facetNameMapping Object containing a mapping from the default facet field names to display labels to be used. The format must be {fieldName: "label", ...}. All values displayed in the facet list can be mapped using this construct, regardless of the display level. If not provided then the ALA.OccurrenceMapUtils.DEFAULT_FACET_NAME object will be used, or field names will be formatted into human-readable form (capitalised, camel-case changed to sentence case, underscores replaced with spaces, etc).
  • excludeFacets List of facet names to exclude from dislay. This list can contain items from any level in the facet list. If not provided, all available facets will be displayed.
  • excludeSingles True to hide any facet group which only contains a single option. Default: true
  • maximumFacets The maximum number of facets that can be selected via the 'choose more' dialog. Default: 15
  • wms True to use a WMS layer to display occurrences, false to render individual points as circles on a clustered map. Default: true
  • mapAttribution Attribution text to be displayed on the map. Default: blank
  • allowColourBy True to include a colour-by control. Default: true
  • showLegend True to include a legend for coloured maps. Default: true
  • pointsConfig options for the points on the map:
    • colour The initial colour (in hex, without the #) to use for rendering occurrence points on the map. Default: #FF9900
    • name The point type (circle, etc). Default: circle
    • size The point radius in px. Default: 4px
    • opacity The point opacity (0 - 1). Default: 1

Parameters

Name Type Description
id String Unique id of the map container div. Mandatory.
biocacheBaseUrl String The base URL of the Biocache instance that will be used as the source for all data. Mandatory.
queryString String The initial query string to use to populate map (it will be passed to the Biocache's search service). This property must include the q= parameter at a minimum. Mandatory.
options Object Configuration options for the map. Optional - sensible defaults will be used if not provided. See the list above.

Constants

Name Description
DEFAULT_OPTIONS Default Map options
self.map The underlying ALA.Map object

Static Methods

Name Description
clearAllFacets Clear all selected facets and update the occurrence map and facet list.
clearFacet Remove a particular selected facet and update the occurrence map and facet list.
getQueryString Retrieve the current query (excluding the server) for the occurrence records on the map
selectFacet Select a particular facet and update the occurrence map and facet list.
self.selectMultipleFacets Select a number of facets, combining them as either AND or OR
setQueryString Set the current query string and update the occurrence map with the results.

clearAllFacets()static

Clear all selected facets and update the occurrence map and facet list.

clearFacet(facet)static

Remove a particular selected facet and update the occurrence map and facet list.

Parameters

Name Type Description
facet Object An object containing a minimum of 'label' and 'fq': the 'fq' property will be used to identify the facet.

DEFAULT_OPTIONSstatic

Default Map options

getQueryString() → {String}static

Retrieve the current query (excluding the server) for the occurrence records on the map

Returns

String The current biocache query string to retrieve the occurrence records

selectFacet(facet, include)static

Select a particular facet and update the occurrence map and facet list.

Parameters

Name Type Description
facet Object An object containing a minimum of 'label' and 'fq': the 'fq' property will be used to identify the facet.
include True to INCLUDE the specified facet. False to EXCLUDE. Default: true.

self.mapstatic

The underlying ALA.Map object

self.selectMultipleFacets(facetsList, and, include)static

Select a number of facets, combining them as either AND or OR

Parameters

Name Type Description
facetsList List of facet objects (containing a minimum of 'label' and 'fq') to be added
and True to combine the facets as a logical AND, false to use a logical OR. Default: true.
include True to INCLUDE the specified facets. False to EXCLUDE. Default: true.

setQueryString(queryString)static

Set the current query string and update the occurrence map with the results.

Parameters

Name Type Description
queryString String the biocache query string to populate the map and facet list