UNPKG

s2-tools

Version:

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

84 lines 3.33 kB
import type { IntermediateNodeMember } from './relation'; import type { Pbf as Protobuf } from '../../readers/protobuf'; import type { InfoBlock, OSMReader } from '.'; /** The expected metadata in the VectorFeature for all types (node, way, relation) */ export interface Metadata { info: InfoBlock; nodes?: IntermediateNodeMember[]; relation?: { role: string; properties: Record<string, string>; }; } /** * NOTE: currently relations are stored, but we don't wait for the Block to store all relations * before we start testing primtiveHandle against the data. This is a problem because * relations reference eachother at times, and we need to be able to resolve those references * before we can run relationHandle against the data. This isn't an important issue since * in practice, all relations that reference eachother often produce garbage or unusable data. * But it would be *nice* to fix this. Morbidly enough, the "BEST" solution is to treat relations * like we do nodes and ways since relations could possibly reference eachother outside their own block. * From a practical standpoint, I can't see this being worth the effort or memory/time cost. */ export declare class PrimitiveBlock { #private; pbf: Protobuf; reader: OSMReader; stringtable: StringTable; primitiveGroups: PrimitiveGroup[]; granularity: number; latOffset: number; lonOffset: number; dateGranularity: number; /** * @param pbf - the Protobuf object to read from * @param reader - the OSMReader to modify */ constructor(pbf: Protobuf, reader: OSMReader); /** * Get a string from the string table at the given index * @param index - the index of the string in the string table * @returns - the string */ getString(index: number): string; /** * Get a record of strings from the string table * @param keys - list of indices for the keys * @param values - list of indices for the values * @returns - the record or object containing the key-value pairs */ tags(keys: number[], values: number[]): Record<string, string>; } /** Group of OSMPrimitives. All primitives in a group must be the same type. */ export declare class PrimitiveGroup { #private; primitiveBlock: PrimitiveBlock; pbf: Protobuf; /** * @param primitiveBlock - the parent PrimitiveBlock * @param pbf - the Protobuf object to read from */ constructor(primitiveBlock: PrimitiveBlock, pbf: Protobuf); } /** * String table, contains the common strings in each block. * Note that we reserve index '0' as a delimiter, so the entry at that * index in the table is ALWAYS blank and unused. * NOTE: OSM isn't safe and allows " inside of strings, so we have to replace them with ' * NOTE: OSM isn't safe and allows \ at the end of strings, so we have to remove them so it can be properly parsed. */ export declare class StringTable { #private; strings: string[]; /** * @param pbf - the Protobuf object to read from */ constructor(pbf: Protobuf); /** * @param index - the index of the string * @returns - the string */ get(index: number): string; } /** This is kept for backwards compatibility but not used anywhere. */ //# sourceMappingURL=primitive.d.ts.map