/layer/featureFormats
The featureFormats module exports utility methods to process the response data from layer queries into Openlayers features.
- Source
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.cluster.max_size property.
| Name | Type | Description |
|---|---|---|
layer | layer | A layer object, likely an OpenLayers layer. |
features | Array | An array of feature data, where each feature is represented as an array. |
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
layer.cluster | layer-cluster | The vector layer cluster configuration. | ||||||
cluster.max_size | integer | The length of features in the largest cluster feature. | ||||||
layer.params | Object | Properties
|
- Source
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.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
features | array | An array of WKT features. |
| Name | Type | Description |
|---|---|---|
layer.srid | string | Feature data projection. |
layer.params | Object | |
params.fields | Array | Array of field names for feature properties. |
- Source
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.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
features | array | An array of WKT features. |
| Name | Type | Description |
|---|---|---|
layer.srid | string | Feature data projection. |
layer.params | Object | |
params.fields | Array | Array of field names for feature properties. |
- Source
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.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
features | array | An array of WKT features. |
| Name | Type | Description |
|---|---|---|
layer.featuresObject | Object | Store feature properties with the feature ID as property key for lookup in the featureStyle method. |
layer.params | Object | |
params.fields | Array | Array of field names for feature properties. |
- Source
(async, inner) wkth3(layer, features) → {array}
The wkth3 featureFormats method processes an array of wkth3 features and returns Openlayers features to be added to the layer source.
A wkth3 feature is an array with the first entry being the cellid. Subsequent array entries are cell properties required to for the featureStyle render.
The layer.params.fields[] property values will be added to the layer.featureFields field values arrays to be processed by the featureFields.process() method.
An attempt will be made to look up an Openlayers geometry object from the cellGeomMap.
Otherwise the coordinates will be parsed from the cell id with h3js.cellToBoundary() method.
An Openlayers polygon geometry will be created from the parsed coordinates. The geometry object will be stored in the cellGeomMap.
The wkt layer format is recommended for the "wkth3" featureFormat.
The geometry field is required for the request viewport parameter. This is used to limit the data displayed to the current mapview extent.
The "no_geom" flag should be set to not return the geometry with the wkt features.This is as it is not required for rendering the h3 cells.
The "qID" flag should return the h3 cell id from the database table for lookup to find the h3 geometry.
The assignment of properties to the cellGeomMap requires each h3 cell to be unique, thus the qID should return a unique h3 cell id for each feature.
"format": "wkt",
"srid": "4326",
"geom": "geom_4326",
"params": {
"viewport": true,
"no_geom": true
},
"featureFormat": "wkth3",
"qID": "h3res9",
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
features | array | An array of wkth3 features. |
| Name | Type | Description |
|---|---|---|
layer.srid | string | Feature data projection. |
layer.params | Object | |
params.fields | Array | Array of field names for feature properties. |
- Source
Array of Openlayers features.
- Type:
- array