Skip to main content

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), 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​

import { featuresToCsv } from "@mapcairn/core";

function featuresToCsv(features: readonly LayerFeature[], info: FeatureFileInfo): string;

Parameters​

  • features (readonly LayerFeature[])
  • info (FeatureFileInfo)

Returns​

string

See also​

Source: packages/core/src/layers/saveFeatures.ts:208