import type { FeatureIterator, MValue, VectorFeatures, Writer } from '../../index.js'; /** * # Shapefile Writer * * ## Description * * Given a writer and an array of iterators, write the input features property data into a SHP file * * NOTE: The correct way to store geometry in a shapefile is to only store one kind of geometry. * However, this libraries writer and reader do not enforce this. * * ## Usage * * #### Write to files * ```ts * import { toSHP, JSONReader } from 'gis-tools-ts'; * import { FileReader, FileWriter } from 'gis-tools-ts/file'; * // or use mmap reader if using bun * // import { MMapReader } from 'gis-tools-ts/mmap'; * // or use a BufferWriter if you are using a browser * // import { BufferWriter } from 'gis-tools-ts'; * * const fileReader = new FileReader(`${__dirname}/fixtures/points.geojson`); * const jsonReader = new JSONReader(fileReader); * const shpWriter = new FileWriter(`${__dirname}/fixtures/points.shp`); * const dbfWriter = new FileWriter(`${__dirname}/fixtures/points.dbf`); * const shxWriter = new FileWriter(`${__dirname}/fixtures/points.shx`); * const prjWriter = new FileWriter(`${__dirname}/fixtures/points.prj`); * * // store to outputs * await toSHP(shpWriter, [jsonReader], dbfWriter, shxWriter, prjWriter); * ``` * * #### Zip the files * ```ts * import { zipFolder } from 'gis-tools-ts'; * * const shpFile = await Bun.file(`${__dirname}/fixtures/points.shp`).arrayBuffer(); * const dbfFile = await Bun.file(`${__dirname}/fixtures/points.dbf`).arrayBuffer(); * const shxFile = await Bun.file(`${__dirname}/fixtures/points.shx`).arrayBuffer(); * const prjFile = await Bun.file(`${__dirname}/fixtures/points.prj`).arrayBuffer(); * * const zippedData = await zipFolder([ * { name: 'points.shp', comment: 'shapefile data', data: shpFile }, * { name: 'points.dbf', comment: 'properties data', data: dbfFile }, * { name: 'points.shx', comment: 'index data', data: shxFile }, * { name: 'points.prj', comment: 'projection', data: prjFile }, * ]); * ``` * * ## Links * - * * @param shpWriter - the shapefile data container to write to * @param iterators - the collection of iterators to write * @param dbfWriter - the dbf data container to write to if provided (properties data) * @param shxWriter - the shx data container to write to if provided (index data) * @param prjWriter - the prj data container to write to if provided (projection) * @param onFeature - A function that takes a feature and returns a feature * @param mValue - If the data has the measurement modifier to the z value and how to find it */ export declare function toSHP(shpWriter: Writer, iterators: FeatureIterator[], dbfWriter?: Writer, shxWriter?: Writer, prjWriter?: Writer, onFeature?: (feature: VectorFeatures) => VectorFeatures | undefined, mValue?: (m: MValue | undefined) => number | undefined): Promise; //# sourceMappingURL=shp.d.ts.map