UNPKG

gis-tools-ts

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

50 lines 1.36 kB
import { OSMReader } from '.'; import { MMapKV, MMapReader } from '../../mmap'; /** * # OSM MMap Reader * * ## Description * Parses OSM PBF files * Implements the {@link FeatureIterator} interface * * ## Usage * ```ts * import { OSMMMapReader } from 'gis-tools-ts/mmap'; * * const reader = new OSMMMapReader('./data.osm.pbf'); * * // pull out the header * const header = reader.getHeader(); * * // read the features * for (const feature of reader) { * console.log(feature); * } * * // close the reader when done * reader.close(); * ``` * * ## Links * - https://wiki.openstreetmap.org/wiki/PBF_Format * - https://github.com/openstreetmap/pbf/blob/master/OSM-binary.md */ export class OSMMMapReader extends OSMReader { options; /** * @param input - The input (may be a local memory filter or file reader) * @param options - User defined options to apply when reading the OSM file */ constructor(input, options) { const fileReader = new MMapReader(input); super(fileReader, options); this.options = options; this.nodeGeometry = new MMapKV(); this.nodes = new MMapKV(); this.wayGeometry = new MMapKV(); this.ways = new MMapKV(); this.relations = new MMapKV(); this.nodeRelationPairs = new MMapKV(); } } //# sourceMappingURL=mmap.js.map