locar-tiler
    Preparing search index...

    Class TilerAbstract

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

    Hierarchy (View Summary)

    Index

    Constructors

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

      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

    Properties

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

    Methods

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

      Returns DataTile[]

      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<Tile>

      Promise resolving with the given Tile.

    • 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: any

        the raw downloaded data.

      Returns DataTile

      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<any>

      a Promise resolving with arbitrary data.

    • 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[]>

      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[]>

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