# featuresToCsv

The features as CSV text, starting with a byte order mark (see
`BYTE_ORDER_MARK`) and with rows ending CRLF. The columns are `feature_id`,
`longitude` and `latitude` (empty unless the feature is a point),
`geometry` (the GeoJSON geometry as text, empty when it is longer than
[`MAX_CSV_CELL_CHARACTERS`](https://docs.mapcairn.com/api/core/MAX_CSV_CELL_CHARACTERS.md)), each decoded field, then
`credit` and `saved`, so the credit and the day travel on every row. A
number is plain decimal text; a text that starts with `=`, `+`, `-`, `@`,
a tab or a carriage return gets a leading apostrophe so a spreadsheet
does not run it as a formula. A field that would repeat a column name is
renamed with a number (`credit_2`).

This is a function exported by `@mapcairn/core`, checked against version 0.2.0.

## Signature

```ts
import { featuresToCsv } from "@mapcairn/core";
 
function featuresToCsv(features: readonly LayerFeature[], info: FeatureFileInfo): string;
```

## Parameters

- `features` (`readonly LayerFeature[]`)
- `info` (`FeatureFileInfo`)

## Returns

`string`

## See also

- [`LayerFeature`](https://docs.mapcairn.com/api/core/LayerFeature.md)
- [`FeatureFileInfo`](https://docs.mapcairn.com/api/core/FeatureFileInfo.md)

Source: [packages/core/src/layers/saveFeatures.ts:208](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/layers/saveFeatures.ts#L208)
