6.6.4 • Published 6 months ago

@types/pbf2json v6.6.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/pbf2json

Summary

This package contains type definitions for pbf2json (https://github.com/pelias/pbf2json).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pbf2json.

index.d.ts

// Type definitions for pbf2json 6.6
// Project: https://github.com/pelias/pbf2json
// Definitions by: Kyle Hensel <https://github.com/k-yle>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="node" />

import stream = require('stream');

/** A key-value pair of OSM tags */
export type Tags = Record<string, string | undefined>;

export interface Coordinate {
    lat: number;
    lon: number;
}
export interface Centroid extends Coordinate {
    type: 'entrance' | undefined;
}

export interface Node extends Coordinate {
    id: number;
    type: 'node';
    tags: Tags;
}
export interface Way {
    id: number;
    type: 'way';
    tags: Tags;
    centroid: Centroid;
    bounds: {
        n: number;
        s: number;
        e: number;
        w: number;
    };
    nodes: Coordinate[];
}
export interface Relation {
    id: number;
    type: 'relation';
    tags: Tags;
    centroid: Centroid;
    bounds: {
        n: number;
        s: number;
        e: number;
        w: number;
    };
}

export type Item = Node | Way | Relation;

export interface Options {
    /** Path to the .pbf file */
    file: string;
    /** To control which tags are output */
    tags?: string[] | undefined;
    /** Path to store temp files */
    leveldb?: string | undefined;
    waynodes?: string | undefined;
}

export interface Decoder extends stream.Transform {
    /** terminate the process and pipeline */
    kill(): void;
}

/**
 * An API to read a .pbf file.
 *
 * Usage:
 * @example
 * ```ts
 * import { createReadStream, Item } from "pbf2json";
 *
 * createReadStream(options).pipe(through2.obj((item: Item, e, next) => {
 *     // ...
 * }))
 * ```
 */
export function createReadStream(options: Options): Decoder;

Additional Details

  • Last updated: Thu, 08 Jul 2021 20:19:29 GMT
  • Dependencies: @types/node
  • Global values: none

Credits

These definitions were written by Kyle Hensel.

6.6.3

7 months ago

6.6.2

8 months ago

6.6.4

6 months ago

6.6.1

3 years ago

6.6.0

3 years ago