Helper class for projection handling. Makes use of Proj4js.

ProjectionUtil

Constructors

Methods

  • Registers custom CRS mappings to allow automatic CRS detection. Sometimes FeatureCollections returned by the GeoServer may be associated with CRS identifiers (e.g. "urn:ogc:def:crs:EPSG::25832") that aren't supported by proj4 and OpenLayers per default. Add appropriate mappings to allow automatic CRS detection by OpenLayers here.

    Parameters

    • customCrsMappings: CrsMapping | CrsMapping[]

      The custom CRS mappings which will be added additionally to the by default available (s. defaultProj4CrsMappings above).

    • useDefaultMappings: boolean = true

      Whether the default CRS should be mapped as well or not. Default is true.

    Returns void

  • Registers custom CRS definitions to the application.

    Parameters

    • Optional customCrsDefs: CrsDefinition | CrsDefinition[]

      The custom proj4 definitions which should be registered additionally to default available CRS (s. defaultProj4CrsDefinitions above) as well. Further CRS definitions in proj4 format can be checked under http://epsg.io (e.g. http://epsg.io/3426.proj4).

    • registerDefaults: boolean = true

      Whether the default CRS should be registered or not. Default is true.

    Returns void

  • Converts geographic coordinates given in DDD format like DD.DDDD° to the degree, decimal minutes (DMM) format like DDD° MM.MMMM.

    Parameters

    • value: number

      Value to be converted.

    Returns string

    Converted value.

  • Converts geographic coordinates given in DDD format like DD.DDDD° to the degree, minutes, decimal seconds (DMS) format like DDD° MM' SS.SSS".

    Parameters

    • value: number

      Value to be converted.

    Returns string

    Converted value.

  • Adds leading zero to all values less than 10 and returns this new zerofilled value as String. Values which are greater than 10 are not affected.

    Parameters

    • value: string | number

      Value to be zerofilled.

    Returns string

    converted value with leading zero if necessary.