Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GeoSpatialUtilities

Hierarchy

  • GeoSpatialUtilities

Index

Methods

Static calculateXTileRange

  • calculateXTileRange(bbox: BoundingBox, zoom: any): object
  • Calculates the ranges of tile need for a given longitude range.

    Taken from Map Cache Electron

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • bbox: BoundingBox

      Geopackage Bounding box

    • zoom: any

      zoom level

    Returns object

    Max and Min X Tiles

    • max: number
    • min: number

Static calculateYTileRange

  • calculateYTileRange(bbox: BoundingBox, zoom: any): object
  • Calculates the ranges of tile need for a given latitude range.

    Taken from Map Cache Electron

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • bbox: BoundingBox
    • zoom: any

      zoom level

    Returns object

    • current: number
    • max: number
    • min: number

Static expandBoundingBoxToIncludeLatLonPoint

  • expandBoundingBoxToIncludeLatLonPoint(boundingBox: BoundingBox, latitude?: number, longitude?: number, copyBoundingBox?: boolean): BoundingBox
  • Expand the bounds to include provided latitude and longitude value.

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • boundingBox: BoundingBox

      Bounding Box to be expanded

    • Optional latitude: number
    • Optional longitude: number
    • Default value copyBoundingBox: boolean = false

    Returns BoundingBox

Static getKmlBBoxRotation

  • getKmlBBoxRotation(bbox: BoundingBox, rotation: number): BoundingBox
  • Uses turf to rotate a bounding box.

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • bbox: BoundingBox

      GeoPackage Bounding Box EPSG:4326

    • rotation: number

      Rotation in degrees; clockwise rotations are negative

    Returns BoundingBox

    GeoPackage Bounding Box Rotated by given number of degrees

Static getNaturalScale

  • getNaturalScale(bbox: BoundingBox, imageWidth: number): number
  • Returns the floor of the zoom level where 1 image pixel equals 1 tile pixel. floor(log_2((360 * imageWidth) / (bbox_width * tile_size)))

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • bbox: BoundingBox

      Must be in EPSG:4326

    • imageWidth: number

      Must be in Pixels

    Returns number

    zoom level

Static getWebMercatorBoundingBox

  • getWebMercatorBoundingBox(currentProjection: string, bbox: BoundingBox): BoundingBox
  • Converts the Min/Max Latitude and Longitude into EPSG:3857 (Web Mercator)

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • currentProjection: string

      EPSG:#### string of the current projection

    • bbox: BoundingBox

      Geopackage Bounding Box

    Returns BoundingBox

    New Geopackage Bounding Box with the transformed coordinates.

Static getWidthAndHeightFromBBox

  • getWidthAndHeightFromBBox(bbox: BoundingBox): object
  • Get height and width of a bounding box

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • bbox: BoundingBox

      geopackage bounding box.

    Returns object

    Object with width and height

    • height: number
    • width: number

Static getZoomLevels

  • getZoomLevels(bbox: BoundingBox, naturalScale: number): Set<number>
  • Creates a list of zoom level where the number of filled tiles changes.

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • bbox: BoundingBox

      Bounding box after rotation

    • naturalScale: number

      Zoom level closest to one to one in terms of pixels

    Returns Set<number>

    A set of zoom levels

Static iterateAllTilesInExtentForZoomLevels

  • iterateAllTilesInExtentForZoomLevels(extent: BoundingBox, zoomLevels: number[], tileCallback: function): Promise<void>
  • Calls function for each tile needed.

    Taken from Map Cache Electron

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • extent: BoundingBox

      Bounding Box

    • zoomLevels: number[]

      Array of Zoom Levels

    • tileCallback: function
        • (arg0: object): Promise<boolean>
        • Parameters

          • arg0: object
            • x: number
            • y: number
            • z: number

          Returns Promise<boolean>

    Returns Promise<void>

Static lat2tile

  • lat2tile(lat: number, zoom: number): number
  • Finds the y position of a tile

    Taken from Map Cache Electron

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • lat: number

      Latitude in degrees

    • zoom: number

      Zoom level

    Returns number

Static long2tile

  • long2tile(lon: number, zoom: number): number
  • Finds the x position of a tile

    Taken from Map Cache Electron

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • lon: number

      longitude in degrees

    • zoom: number

      Zoom level

    Returns number

Static tile2lat

  • tile2lat(y: number, zoom: number): number
  • Finds the Latitude of a tile

    Taken from Map Cache Electron

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • y: number

      y tile coordinate

    • zoom: number

      Zoom level

    Returns number

Static tile2lon

  • tile2lon(x: number, zoom: number): number
  • Finds the Longitude of a tile

    Taken from Map Cache Electron

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • x: number

      x tile coordinate

    • zoom: number

      zoom level

    Returns number

Static tileBboxCalculator

  • tileBboxCalculator(x: number, y: number, zoom: number): BoundingBox
  • Converts tiles to a geopackage Bounding box.

    static
    memberof

    GeoSpatialUtilities

    Parameters

    • x: number

      x tile position

    • y: number

      y tile position

    • zoom: number

      zoom level

    Returns BoundingBox

    Geopackage Bounding box.

Generated using TypeDoc