Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains constants for Proj4js definitions of various coordinate reference systems, as well as some utilities for handling and formatting projections.

The epsg file contains literally thousands of Proj4js definitions for EPSG codes on the form EPSG_..., but only the most relevant for Danish use are listed below.

Index

Variables

CRS_84

CRS_84: { defs: string; srid: string } = ...

Proj4js definition for WGS 84 decimal degrees, X/Y notation (longitude/laitude)

Type declaration

  • defs: string
  • srid: string

DENMARK_25832

DENMARK_25832: Extent = ...

A bounding box in [minx, minY, maxX, maxY] EPSG:25832 coordinates covering Denmark.

DENMARK_84

DENMARK_84: Extent = ...

A bounding box in [minx, minY, maxX, maxY] CRS:84 coordinates covering Denmark.

EPSG_25832

EPSG_25832: { defs: string; srid: string } = ...

Proj4js definition for ETRS89 / UTM Zone 32

Type declaration

  • defs: string
  • srid: string

EPSG_3857

EPSG_3857: { defs: string; srid: string } = ...

Proj4js definition for spherical pseudo-Mercator. The Google Maps-style "The Earth is a sphere; deal with it" which makes cartographers cry

Type declaration

  • defs: string
  • srid: string

EPSG_4093

EPSG_4093: { defs: string; srid: string } = ...

Proj4js definition for DKTM 1 – Danish local Mercator

Type declaration

  • defs: string
  • srid: string

EPSG_4094

EPSG_4094: { defs: string; srid: string } = ...

Proj4js definition for DKTM 2 – Danish local Mercator

Type declaration

  • defs: string
  • srid: string

EPSG_4095

EPSG_4095: { defs: string; srid: string } = ...

Proj4js definition for DKTM 3 – Danish local Mercator

Type declaration

  • defs: string
  • srid: string

EPSG_4096

EPSG_4096: { defs: string; srid: string } = ...

Proj4js definition for DKTM 4 – Danish local Mercator

Type declaration

  • defs: string
  • srid: string

EPSG_4326

EPSG_4326: { defs: string; srid: string } = ...

Proj4js definition for WGS 84 decimal degrees, Y/X notation (latitude/longitude)

Type declaration

  • defs: string
  • srid: string

EPSG_900913

EPSG_900913: { defs: string; srid: string } = ...

Legacy name for EPSG_3857

Type declaration

  • defs: string
  • srid: string

danishEpsg

danishEpsg: { defs: string; srid: string }[] = ...

Two handfuls of relevant projections for Denmark: WGS:84 in X/Y and Y/X notation, UTM Zone 32 and 33, the four DKTM zones, and Spherical Pseudo-Mercator in Google and EPSG notation

epsg

epsg: { defs: string; srid: string }[] = ...

All EPSG codes. Be aware that while you can easily do something like epsg.forEach(def => proj4.defs(def.srid, def.defs)); to register every one for internal math use in Proj4js, registering the resulting bundle in OpenLayers with [ol/proj/proj4]register(proj4) is a surprisingly heavy operation. So only define the ones you actually need for the map before calling register(proj4).

Functions

guessDanishProjection

  • guessDanishProjection(x: number, y: number): string | undefined
  • Examines the given coordinates to determine which coordinate reference system it is, given that the coordinates are somewhere in Denmark.

    It recognizes Google Maps-style spherical pseudo-Mercator (EPSG:3857), the Danish DKTM zones (EPSG:4093, EPSG:4094, EPSG:4095 and EPSG:4096), WGS84 x/y notation (CRS:84) and WGS84 lat/lon (y/x) notation (EPSG:4326). It also recognizes the ETRS89 UTM projection, but it cannot differentiate between zone 32 and zone 33, so all coordinates in that range will be reported as EPSG:25832, which conventionally is used for all of Denmark.

    (Bornholm expressed in Zone 33 has coordinates in the same range as South-Western Jutland expressed in Zone 32, so there is no way to differentiate between them without additional knowledge).

    Parameters

    • x: number
    • y: number

    Returns string | undefined

projectionCode

  • projectionCode(proj: any): string
  • Attempts to find the projection code of an object, either carried in a srid property (as the constants in this module do), or by invoking getCode() if the object is an OpenLayers {@link Projection}

    Parameters

    • proj: any

    Returns string

    The projection code carried in the object, or an empty string otherwise. (Notice that it does not return undefined).

projectionCodeAndTitle

  • projectionCodeAndTitle(proj: any): string
  • Simple convenience for returning a description on the form "code – title", e.g. "EPSG:25832 – ETRS89 / UTM zone 32N", or an empty string if no projection is registered (per recognizedProjectionCode) or the projection does not have a title.

    Parameters

    • proj: any

    Returns string

projectionTitle

  • projectionTitle(proj: any): string
  • Finds a projection per projectionCode, and looks up the projection in the proj4 definitions, returning the associated title, if any.

    Parameters

    • proj: any

    Returns string

recognizedProjectionCode

  • recognizedProjectionCode(proj: any): string
  • As per projectionCode, but additionally checks whether the code is one recognized in the current {@link proj4} instance. (Typically, previously registered with proj4.defs(...).)

    Parameters

    • proj: any

    Returns string