geoview-core
    Preparing search index...

    Class ProjectionAbstract

    Class used to handle functions for transforming projections

    Projection

    Index

    Constructors

    Properties

    CUSTOM_WKT_AND_NUM: { [wkt_num: string]: string } = {}
    CUSTOM_WKT_NUM: number = 1001
    PROJECTION_NAMES: Record<string, string> = ...

    constant used for the available projection names

    PROJECTIONS: Record<string, OLProjection> = {}

    List of supported projections and their OpenLayers projection

    Methods

    • Fetches definitions for unsupported projections and adds them.

      Parameters

      • projection: TypeProjection

        Object containing wkid and possibly latestWkid from service metadata.

      Returns Promise<void>

    • Fetches definitions for unsupported projections and adds them.

      Parameters

      • code: number

        Projection code number.

      Returns Promise<void>

    • Checks if a projection exists for GeoView and if not it adds it on-the-fly using the provided projection string information.

      Parameters

      • projection: TypeProjection | ProjectionLike

        The projection string to check if existing and to add when not existing.

      Returns Promise<void>

    • Wrapper around OpenLayers get function that fetches a Projection object for the code specified.

      Parameters

      • projectionObj: TypeProjection | undefined

        A projection object with properties such as latestWkid, wkid, or wkt.

      Returns Projection | undefined

      — Projection object, or undefined if not in list.

    • Wrapper around OpenLayers get function that fetches a Projection object for the code specified.

      Parameters

      • projection: ProjectionLike

        A code string which is a combination of authority and identifier such as "EPSG:4326".

      Returns Projection

      Projection object, or undefined if not found.

    • Wrapper around OpenLayers get function that fetches a Projection object for the code specified.

      Parameters

      • customWKT: string

        A code string which is a combination of authority and identifier such as "EPSG:4326".

      Returns Projection

      Projection object, or undefined if not in list.

    • Gets the projection representing a LonLat projection.

      Returns Projection

      Projection object representing LonLat.

    • Get map point resolution

      Parameters

      • projection: string

        The projection code

      • center: Coordinate

        Map center

      Returns number

      The point resolution for map center

    • Reads the numeric EPSG code from a projection string. Supports case-insensitive formats such as:

      • "EPSG:4326"
      • "epsg:3857"
      • "EpSg: 1234" The function trims whitespace and validates that the string matches a proper EPSG:<number> pattern. Returns undefined if the format is invalid or the numeric part is not a valid number.

      Parameters

      • projection: ProjectionLike

        The projection like identifier containing the EPSG code.

      Returns number | undefined

      The extracted EPSG numeric code, or undefined if invalid.

    • Reads an extent and verifies if it might be reversed (ymin,xmin,ymax,ymin) and when so puts it back in order (xmin,ymin,xmax,ymax).

      Parameters

      • projection: string

        The projection the extent is in

      • extent: Extent

        The extent to check

      Returns Extent

      The extent in order (xmin,ymin,xmax,ymax).

    • Wrapper around OpenLayers function to transforms a coordinate from one projection to another.

      Parameters

      • coordinate: Coordinate

        Longitude/latitude coordinate

      • inProjection: Projection

        Actual projection of the coordinate

      • outProjection: Projection

        Desired projection of the coordinate

      Returns Coordinate

      Coordinate as projected

    • Transforms an extent from source projection to destination projection. This returns a new extent (and does not modify the original).

      Parameters

      • extent: Extent

        The extent to transform.

      • source: Projection

        Source projection-like.

      • destination: Projection

        Destination projection-like.

      • stops: number = 25

        Optional number of stops per side used for the transform. The default value is 25.

      Returns Coordinate[]

      The densified extent transformed in the destination projection.

    • Transform coordinates between two projections

      Parameters

      • coordinates: Coordinate | Coordinate[] | Coordinate[][] | Coordinate[][][] | undefined

        The coordinates to transform

      • startProjection: string

        The current projection of the coordinates. Note: the value should include 'EPSG:' then the projection number.

      • endProjection: string

        The transformed projection of the coordinates. Note: the value should include 'EPSG:' then the projection number.

      Returns Coordinate | Coordinate[] | Coordinate[][] | Coordinate[][][] | undefined

      The transformed coordinates

    • Transforms an extent from source projection to destination projection. This returns a new extent (and does not modify the original).

      Parameters

      • extent: Extent

        The extent to transform.

      • projection: TypeProjection | undefined

        An object containing a wkid or wkt property.

      • destination: Projection

        Destination projection-like.

      • Optionalstops: number

        Optional number of stops per side used for the transform. By default only the corners are used.

      Returns Extent

      The new extent transformed in the destination projection.

    • Transforms an extent from source projection to destination projection. This returns a new extent (and does not modify the original).

      Parameters

      • extent: Extent

        The extent to transform.

      • source: Projection

        Source projection-like.

      • destination: Projection

        Destination projection-like.

      • Optionalstops: number

        Optional number of stops per side used for the transform. By default only the corners are used.

      Returns Extent

      The new extent transformed in the destination projection.

    • Transforms an extent from source projection to destination projection. This returns a new extent (and does not modify the original).

      Parameters

      • extent: Extent

        The extent to transform.

      • wkid: number

        An EPSG id number.

      • destination: Projection

        Destination projection-like.

      • Optionalstops: number

        Optional number of stops per side used for the transform. By default only the corners are used.

      Returns Extent

      The new extent transformed in the destination projection.

    • Transforms an extent from source projection to destination projection. This returns a new extent (and does not modify the original).

      Parameters

      • extent: Extent

        The extent to transform.

      • customWKT: string

        A custom WKT projection.

      • destination: Projection

        Destination projection-like.

      • Optionalstops: number

        Optional number of stops per side used for the transform. By default only the corners are used.

      Returns Extent

      The new extent transformed in the destination projection.

    • Wrapper around OpenLayers function to transforms a coordinate from longitude/latitude.

      Parameters

      • coordinate: Coordinate

        Longitude/latitude coordinate

      • projection: Projection

        Projection to project the coordinate

      Returns Coordinate

      Coordinate as projected

    • Converts points from one projection to another using proj4

      Parameters

      • points: Coordinate[]

        Array of passed in points to convert

      • fromProj: string

        Projection to be converted from

      • toProj: string

        Projection to be converted to

      Returns number[][]

    • Wrapper around OpenLayers function to transforms a coordinate to longitude/latitude.

      Parameters

      • coordinate: Coordinate

        Projected coordinate

      • projection: Projection

        Projection of the coordinate

      Returns Coordinate

      Coordinate as longitude and latitude, i.e. an array with longitude as 1st and latitude as 2nd element.

    • Function for converting a coordinate to a UTM Northing / Easting

      Parameters

      • coordinate: Coordinate

        The coordinate to be converted

      • utmZone: string

        The utm zone the return coordinates will be in

      Returns Coordinate

      The returned coordinates in UTM Northing / Easting