Features - CSV

speccustomimplcandidate

Encode features as comma-separated values (CSV).

Scope

Feature properties that are arrays or objects are always flattened using the flatten transformation, by default using '.' as the separator. Array properties are limited to maxMultiplicity values.

Geometry properties are ignored.

Configuration

Options

NameDefaultDescriptionTypeSince
buildingBlock
Always CSV.
string
v2.0
extensionType
Deprecated See buildingBlock.
string
v2.0
enabled
false
Enable the building block?
boolean
v2.0
transformations
{}
Property transformations do not affect data sources, they are applied on-the-fly as part of the encoding. Filter expressions do not take transformations into account, they have to be based on the source values. That means queryable properties (see queryables in Features) should not use transformations in most cases. The exception to the rule is the HTML encoding, where readability might be more important than filter support.
object
v2.0
maxMultiplicity
3
If the feature schema includes array properties, maxMultiplicity properties will be created for each array property. If an instance has more values in an array, only the first values are included in the data.
number
v3.2

Examples

The following configuration enables CSV as a feature encoding, where all objects and arrays are flattened with an underscore as a separator and two properties per array property.


- buildingBlock: CSV
  enabled: true
  transformations:
    '*':
      flatten: '_'
  maxMultiplicity: 2

For a feature with the following "properties" member in GeoJSON:


{
  "att1": "foo",
  "att2": [ "bar1", "bar2", "bar3" ]
  "att3": {
    "value": 123,
    "values": [ 456, 789, 0 ]
  }
}

The resulting CSV file would be:


att1,att2_1,att2_2,att3_value,att3_values_1,att3_values_2
foo,bar1,bar2,123,456,789