RegionProviderList

RegionProviderList

new RegionProviderList(corsProxy)

Source:

RegionProviderList encapsulates the regionMapping.json file and provides support for choosing the best region provider for a given dataset.

Parameters:
Name Type Description
corsProxy

A proxy to allow the region providers to make AJAX calls safely.

Members

regionProviders :Array.<RegionProvider>

Source:

List of RegionProviders, once loaded from file.

Type:

Methods

(static) fromUrl(url) → {Promise}

Source:

Returns a promise for a RegionProviderList instantiated from this url. Previous loads are cached.

Parameters:
Name Type Description
url String
Returns:

A promise for a RegionProviderList instantiated from this url.

Type
Promise

getRegionDetails(variableNames, variableNames) → {Array.<Object>}

Source:

Find what kind of region-mapped dataset this is by exhaustively looking for every alias for every variable name provided. You can optionally provide a prefered region variable name, and optionally its prefered type. If specified, getRegionDetails will return that name as the first object in the returned array.

Parameters:
Name Type Description
variableNames Array.<String>

Array of names of variables to choose amongst.

variableNames Array.<String>

Array of names of variables to choose amongst.

Returns:

An array of objects with regionProvider (RegionProvider), regionVariable and disambigVariable properties, for each potential region variable in the list of names.

Type
Array.<Object>

getRegionProvider(regionType) → {RegionProvider}

Source:

Get the region provider matching a regionType string (eg, STE)

Parameters:
Name Type Description
regionType String

The type string to look up.

Returns:

The region provider matching a regionType string (eg, STE), or undefined.

Type
RegionProvider

initFromObject(obj)

Source:

Initialises from the already-retrieved contents of a JSON file.

Parameters:
Name Type Description
obj Object