gis-tools-ts - v0.6.0
    Preparing search index...

    Class Tile<M, D, P>

    Tile Class

    Tile Class to contain the tile information for splitting or simplifying

    • face - the tile's face
    • zoom - the tile's zoom
    • i - the tile's x position
    • j - the tile's y position
    • layers - the tile's layers
    • transformed - whether the tile feature geometry has been transformed to tile coordinates
    import { Tile } from 'gis-tools-ts';
    // create a tile
    const tile = new Tile(id);
    // add a feature
    tile.addFeature(feature);
    // transform the geometry to be relative to the tile
    tile.transform();

    If you have some kind reader you can use the addReader method to build the tiile

    import { Tile, JSONReader } from 'gis-tools-ts';
    import { FileReader } from 'gis-tools-ts/file';
    // create a tile
    const tile = new Tile(id);
    // add a reader
    const fileReader = new FileReader(`${__dirname}/fixtures/points.geojson`);
    const jsonReader = new JSONReader(fileReader);
    await tile.addReader(jsonReader);
    // then transform
    tile.transform();

    Type Parameters

    • M = Record<string, unknown>
    • D extends MValue = Properties
    • P extends Properties = Properties
    Index

    Constructors

    • Type Parameters

      • M = Record<string, unknown>
      • D extends Properties = Properties
      • P extends Properties = Properties

      Parameters

      • id: bigint

        the tile id

      • layers: Record<string, Layer<M, D, P>> = {}

        the tile's layers

      • transformed: boolean = false

        whether the tile feature geometry has been transformed to tile coordinates

      Returns Tile<M, D, P>

    Properties

    layers: Record<string, Layer<M, D, P>> = {}

    the tile's layers

    transformed: boolean = false

    whether the tile feature geometry has been transformed to tile coordinates

    Methods

    • Add a vector feature to the tile, optionally to a specific layer to store it in. Defaults to "default".

      Parameters

      • feature: VectorFeatures<M, D, P>

        Vector Feature

      • Optionallayer: string

        layer to store the feature to

      Returns void

    • Add features from a reader to the tile, optionally to a specific layer to store it in. Defaults to "default".

      Parameters

      • reader: FeatureIterator<M, D, P>

        the reader containing the input data

      • Optionallayer: string

        layer to store the feature to

      Returns Promise<void>

    • Returns boolean

      true if the tile is empty of features

    • Simplify the geometry to have a tolerance which will be relative to the tile's zoom level. NOTE: This should be called after the tile has been split into children if that functionality is needed.

      Parameters

      • tolerance: number

        tolerance

      • Optionalmaxzoom: number

        max zoom at which to simplify

      Returns void