/** * GTFS to OSM conversion utilities. * * Imports GTFS transit feeds into Osm indexes, mapping: * - Stops → Nodes with transit tags * - Routes → Ways with shape geometry * * Uses lazy, on-demand parsing - files are only parsed when needed. * * @module */ import { Osm, type OsmOptions } from "@osmix/core"; import { type ProgressEvent } from "@osmix/shared/progress"; import { GtfsArchive } from "./gtfs-archive.ts"; import type { GtfsConversionOptions } from "./types.ts"; /** * Create an Osm index from a zipped GTFS file. * * Parses the GTFS zip lazily - only reading files when needed. * Converts stops and routes to OSM entities: * - Stops become nodes with transit-related tags * - Routes become ways with shape geometry (if available) or stop sequence * * @param zipData - The GTFS zip file as ArrayBuffer or Uint8Array * @param options - Osm index options (id, header) * @param gtfsOptions - GTFS conversion options * @param onProgress - Progress callback for UI feedback * @returns Populated Osm index with built indexes * * @example * ```ts * import { fromGtfs } from "@osmix/gtfs" * * const response = await fetch("https://example.com/gtfs.zip") * const zipData = await response.arrayBuffer() * const osm = await fromGtfs(zipData, { id: "transit" }) * * console.log(`Imported ${osm.nodes.size} stops`) * ``` */ export declare function fromGtfs(zipData: ArrayBuffer | Uint8Array, options?: Partial, gtfsOptions?: GtfsConversionOptions, onProgress?: (progress: ProgressEvent) => void): Promise; /** * Builder class for converting GTFS data to OSM entities. * * Uses lazy parsing - only reads GTFS files when needed. */ export declare class GtfsOsmBuilder { private osm; private onProgress; private nextNodeId; private nextWayId; private stopIdToNodeId; constructor(osmOptions?: Partial, onProgress?: (progress: ProgressEvent) => void); /** * Process GTFS stops into OSM nodes. * Uses streaming iteration to avoid loading all stops at once. */ processStops(archive: GtfsArchive): Promise; /** * Process GTFS routes into OSM ways. * Creates one way per unique (shape_id, route_id) pair, so each route gets * its own way with correct metadata even when routes share the same shape. * * @param archive - The GTFS archive */ processRoutes(archive: GtfsArchive): Promise; /** * Create a way from shape points. */ private createWayFromShape; /** * Build the OSM index with all entities. */ buildOsm(): Osm; } //# sourceMappingURL=from-gtfs.d.ts.map