/ui/utils/locationCount

Exports the default locationCount utility method as mapp.ui.utils.locationCount().

Methods

(inner) locationCount(layer) → {Integer}

Returns the length of the layer.Features[] array or the response from a layer_count query.

The layer.Features[] array length is returned if the filter is not restricted to the viewport, or if the layer features have been loaded for the viewport. Cluster layer features are not counted as locations.

The layer.loading promise must resolve before the layer.Features[] array can be counted. The previous layer.Features[] would otherwise be counted while the request for the current filter is still pending. The layer.loading promise is assigned by the vector layer reload method before the request is debounced, and resolves once the features of the latest request have been set. The location_count query does not wait for the layer data to load.

Parameters:
NameTypeDescription
layerlayer
Properties
NameTypeAttributesDescription
layer.loadingPromise<optional>

Resolves once the features of the latest layer data request have been set.

layer.keyString

The layers' identifier.

layer.formatString

The layer format.

layer.filterObject

The filter currently active on the layer.

layer.paramsObject<optional>

The parameters for the layer data query.

layer.mapviewObject

The mapview associated to the layer.

layer.queryparamsObject<optional>

The query parameters that are being used on the layer.

Returns:

The number of locations that pass the filter.

Type: 
Integer