gis-tools-ts - v0.6.0
    Preparing search index...

    Function toJSON

    • Given a writer and an array of iterators, write the input features to the writer as a JSON object

      Usage:

      import { toJSON, 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';

      const fileReader = new FileReader(`${__dirname}/fixtures/points.geojson`);
      const jsonReader = new JSONReader(fileReader);
      const bufWriter = new FileWriter(`${__dirname}/fixtures/points2.geojson`);

      // store to singular output
      await toJSON(bufWriter, [jsonReader], { projection: 'WG', buildBBox: true });

      Parameters

      • writer: Writer

        the writer to append strings to

      • iterators: FeatureIterator<
            Record<string, unknown>,
            Properties,
            Properties,
            VectorGeometry<Properties>,
        >[]

        the collection of iterators to write

      • Optionalopts: ToJSONOptions

        user defined options [optional]

      Returns Promise<void>