locar-tiler
    Preparing search index...

    Class Tiler<T, TRaw>Abstract

    Represents a tiler, capable of delivering Tiles from a given URL.

    Type Parameters

    • T
    • TRaw = T

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new Tiler. Can only be called by subclasses as Tiler is abstract.

      Type Parameters

      • T
      • TRaw = T

      Parameters

      • url: string

        the URL of the tile server. Use the characters x, y and z in braces for placeholders for the x,y,z parameters.

      Returns Tiler<T, TRaw>

    Properties

    dataTiles: Map<string, DataTile<T>>
    tile: Tile
    url: string

    Methods

    • Obtain the current tiles surrounding the last-requested position.

      Returns DataTile<T>[]

      array of 9 tiles, including the current tile and the 8 surrounding it.

    • For a given Spherical Mercator position and zoom, downloads data if necessary and returns the data at the tile corresponding to that position.

      Parameters

      • sphMercPos: EastNorth

        the Spherical Mercator position.

      • z: number = 13

        zoom level to use (default 13)

      Returns Promise<DataTile<T>>

      Promise resolving with the given Tile, or null if it couldn't be loaded

    • Obtain the Tile containing a given Spherical Mercator position.

      Parameters

      Returns Tile

      the Tile containing the position.

    • Convert longitude/latitude to Spherical Mercator coordinates.

      Parameters

      • lonLat: LonLat

        the LonLat to convert.

      Returns EastNorth

      the EastNorth (Spherical Mercator coordinates).

    • Converts the raw data from the server to a custom type of data. By default, returns a DataTile object containing the Tile and the raw data returned from readTile(), but this can be overridden (e.g. in DemTile the data of the DataTile is a DEM object).

      Parameters

      • tile: Tile

        the current tile.

      • data: TRaw

        the raw downloaded data.

      Returns DataTile<T>

      the DataTile pairing the Tile and the data in the format we want.

    • Abstract method to read the data from a URL. The placeholders will be replaced with the current actual values.

      Parameters

      • url: string

        the URL.

      Returns Promise<TRaw>

      a Promise resolving with arbitrary data. The raw data type might not be the same as the tiled type, e.g. in the DemTiler, the raw data is RawPngData but the tiled data type is DEM.

    • Sets the zoom.

      Parameters

      • z: number

        the zoom to use.

      Returns void

    • Download new tiles for a given Spherical Mercator position.

      Parameters

      • pos: EastNorth

        the Spherical Mercator position.

      Returns Promise<DataTile<T>[]>

      a Promise resolving with an array of the newly-downloaded data tiles (only new tiles; existing ones are not returned)

    • Download new tiles for a given longitude/latitude.

      Parameters

      Returns Promise<DataTile<T>[]>

      a Promise resolving with an array of the newly-downloaded data tiles (only new tiles; existing ones are not returned)