/layer/featureFormats

The featureFormats module exports utility methods to process the response data from layer queries into Openlayers features.

Methods

(inner) cluster(layer, features) → {Array}

The cluster function processes an array of feature data and returns an array of OpenLayers features to be added to the layer source.

It creates Point geometries from coordinate pairs, extracts count and ID information, and assigns additional properties based on the layer's field definitions.

The function also tracks the maximum count across all features in the layer.max_size property.

Parameters:
NameTypeDescription
layerlayer

A layer object, likely an OpenLayers layer.

featuresArray

An array of feature data, where each feature is represented as an array.

Properties
NameTypeDescription
layer.max_sizenumber

The maximum count across all features.

layer.paramsObject
Properties
NameTypeDescription
fieldsArray

Array of field names for additional feature properties.

Returns:

Array of OpenLayers Feature objects.

Type: 
Array

(inner) geojson(layer, features) → {array}

The geojson featureFormats method processes an array of wkt features and returns Openlayers features to be added to the layer source.

The geometry of the features will be projected from the layer.srid data projection to the layer.mapview.srid projection for display in the mapview.Map.

The layer.params.fields[] property values will be added to the layer.featureFields field values arrays to be processed by the featureFields.process() method.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer object.

featuresarray

An array of WKT features.

Properties
NameTypeDescription
layer.sridstring

Feature data projection.

layer.paramsObject
params.fieldsArray

Array of field names for feature properties.

Returns:

Array of Openlayers features.

Type: 
array

(inner) wkt(layer, features) → {array}

The wkt featureFormats method processes an array of wkt features and returns Openlayers features to be added to the layer source.

The geometry of the features will be projected from the layer.srid data projection to the layer.mapview.srid projection for display in the mapview.Map.

The layer.params.fields[] property values will be added to the layer.featureFields field values arrays to be processed by the featureFields.process() method.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer object.

featuresarray

An array of WKT features.

Properties
NameTypeDescription
layer.sridstring

Feature data projection.

layer.paramsObject
params.fieldsArray

Array of field names for feature properties.

Returns:

Array of Openlayers features.

Type: 
array

(inner) wkt_properties(layer, features)

In order to process featureFields for tiled datasets it is required to request the feature properties separate from the vector tile geometries.

The property features do not have a geometry property and the wkt_properties method does not return an array of Openlayers features.

The feature properties are assigned to the layer.featuresObject{} with the feature ID as property key for lookup of the properties in the featureStyle method.

The layer.params.fields[] property values will be added to the layer.featureFields field values arrays to be processed by the featureFields.process() method.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer object.

featuresarray

An array of WKT features.

Properties
NameTypeDescription
layer.featuresObjectObject

Store feature properties with the feature ID as property key for lookup in the featureStyle method.

layer.paramsObject
params.fieldsArray

Array of field names for feature properties.