Class UnitsUtils

Units utils contains methods to convert data between representations.

Multiple methods are used to reprent world coordinates based on the type of data being presented.

WGS84 is the most commonly used representation with (latitude, longitude, altitude).

EPSG:900913 is used for planar coordinates in (X, Y, Z)

Hierarchy

  • UnitsUtils

Constructors

Properties

EARTH_ORIGIN: number = ...

Earth equator perimeter in meters.

EARTH_PERIMETER: number = ...

Earth equator perimeter in meters.

EARTH_RADIUS: number = 6371008

Average radius of earth in meters.

EARTH_RADIUS_A: number = 6378137.0

Earth radius in semi-major axis A as defined in WGS84.

EARTH_RADIUS_B: number = 6356752.314245

Earth radius in semi-minor axis B as defined in WGS84.

WEB_MERCATOR_MAX_EXTENT: number = 20037508.34

Largest web mercator coordinate value, both X and Y range from negative extent to positive extent

Methods

  • Converts coordinates from WGS84 Datum to XY in Spherical Web Mercator EPSG:900913.

    Parameters

    • latitude: number

      Latitude value in degrees.

    • longitude: number

      Longitude value in degrees.

    Returns Vector2

  • Get a direction vector from WGS84 coordinates.

    The vector obtained will be normalized.

    Returns

    Direction vector normalized.

    Parameters

    • latitude: number

      Latitude value in degrees.

    • longitude: number

      Longitude value in degrees.

    Returns Vector3

  • Get the size of a tile in web mercator coordinates *

    Returns

    the size of the tile in web mercator coordinates

    Parameters

    • zoom: number

      the zoom level of the tile

    Returns number

  • Converts quad tree zoom/x/y to lat/lon in WGS84 Datum.

    The X and Y start from 0 from the top/left corner of the quadtree up to (4^zoom - 1)

    Parameters

    • zoom: number

      Zoom level of the quad tree.

    • x: number

      X coordinate.

    • y: number

      Y coordinate.

    Returns Geolocation

  • Get the bounds of a tile in web mercator coordinates *

    Returns

    list of bounds - [startX, sizeX, startY, sizeY]

    Parameters

    • zoom: number

      the zoom level of the tile

    • x: number

      the x coordinate of the tile

    • y: number

      the y coordinate of the tile

    Returns number[]

  • Direction vector to WGS84 coordinates.

    Can be used to transform surface points of world sphere to coordinates.

    Returns

    WGS84 coordinates.

    Parameters

    • dir: Vector3

      Direction vector.

    Returns Geolocation

  • Get the latitude value of a given web mercator coordinate and zoom level

    Returns

    • latitude of coordinate in radians

    Parameters

    • zoom: number

      the zoom level of the coordinate

    • y: number

      the y web mercator coordinate

    Returns number

  • Get the latitude value of a given web mercator coordinate and zoom level

    Returns

    • longitude of coordinate in radians

    Parameters

    • zoom: number

      the zoom level of the coordinate

    • x: number

      the x web mercator coordinate

    Returns number

Generated using TypeDoc