/** * PBF-to-JSON conversion utilities. * * Transforms raw OSM PBF byte streams into typed JSON entities with decoded * string tables, resolved coordinates, and parsed tags. * * @module */ import { type OsmPbfBlock, type OsmPbfHeaderBlock } from "@osmix/pbf"; import type { OsmEntity } from "@osmix/types"; /** * Convert a PBF byte stream into a stream of JSON entities. * * Pipes raw PBF bytes through block decoding and entity parsing, yielding * the header block first, then individual nodes, ways, and relations as * typed JSON objects. * * @param pbf - ReadableStream of raw PBF bytes. * @returns ReadableStream yielding header block and JSON entities. * * @example * ```ts * import { osmPbfToJson } from "@osmix/json" * import { toAsyncGenerator } from "@osmix/pbf" * * const stream = osmPbfToJson(Bun.file('./monaco.pbf').stream()) * for await (const item of toAsyncGenerator(stream)) { * if ("id" in item) { * // item is OsmNode | OsmWay | OsmRelation * console.log(item.id, item.tags) * } else { * // item is OsmPbfHeaderBlock * console.log(item.required_features) * } * } * ``` */ export declare function osmPbfToJson(pbf: ReadableStream>): ReadableStream; /** * TransformStream that converts OSM PBF blocks into JSON entities. * * Accepts header and primitive blocks from `OsmPbfBytesToBlocksTransformStream` * and emits the header unchanged, followed by individual JSON entities extracted * from each primitive group. * * @example * ```ts * const jsonStream = blocksStream.pipeThrough(new OsmBlocksToJsonTransformStream()) * ``` */ export declare class OsmBlocksToJsonTransformStream extends TransformStream { constructor(); } /** * Extract JSON entities from a single primitive block. * * Iterates through all primitive groups in the block and yields parsed * nodes, ways, and relations with decoded tags and coordinates. * * @param block - Parsed primitive block with string table and groups. * @yields Individual OsmNode, OsmWay, or OsmRelation objects. */ export declare function blocksToJsonEntities(block: OsmPbfBlock): Generator; //# sourceMappingURL=pbf-to-json.d.ts.map