import type { FeatureIterator, Reader, ReaderInputs } from '..'; import type { MValue, Properties, VectorFeature } from '../../geometry'; /** User defined options on how to parse the CSV file */ export interface CSVReaderOptions { /** The delimiter to use to separate lines [Default=','] */ delimiter?: string; /** The lineDelimiter to use to separate lines [Default='\n'] */ lineDelimiter?: string; /** If provided the lookup of the longitude [Default='lon'] */ lonKey?: string; /** If provided the lookup of the latitude [Default='lat'] */ latKey?: string; /** If provided the lookup for the height value [Default=undefined] */ heightKey?: string; } /** * # CSV Reader * * ## Description * Parse (Geo|S2)JSON from a file that is in the CSV format * Implements the {@link FeatureIterator} interface * * ## Usage * ```ts * import { CSVReader } from 's2-tools'; * import { FileReader } from 's2-tools/file'; * * const fileReader = new FileReader(`${__dirname}/fixtures/basic3D.csv`); * const csvReader = new CSVReader(fileReader, { * delimiter: ',', * lineDelimiter: '\n', * lonKey: 'Longitude', * latKey: 'Latitude', * heightKey: 'height', * }); * // read the features * for await (const feature of reader) { * console.log(feature); * } * ``` */ export declare class CSVReader, D extends MValue = MValue, P extends Properties = Properties> implements FeatureIterator { #private; reader: Reader; /** * @param input - the input data to parse from * @param options - user defined options on how to parse the CSV file */ constructor(input: ReaderInputs, options?: CSVReaderOptions); /** * Generator to iterate over each (Geo|S2)JSON object in the file * @yields {VectorFeature} */ [Symbol.asyncIterator](): AsyncGenerator>; } /** * Parse CSV data into a record * @param source - the source of the CSV data * @returns - an object with key-value pairs whose keys and values are both strings */ export declare function parseCSVAsRecord>(source: string): T[]; //# sourceMappingURL=index.d.ts.map