Projections · Angular, React and OpenLayers

A single image WMS in the Polish 1992 grid

Request single-image WMS 1.3.0 maps in Polish 1992 grid (EPSG:2180) using OpenLayers Projection axisOrientation neu and GeoServer HiDPI DPI.

GUGiK's topographic map of Kraków and its surroundings in the Polish 1992 grid, with the Tenczyn and Bielany-Tyniec landscape parks in yellow west of the city and their buffer zones labelled, and a 5 km scale line in the bottom left corner.
A screenshot of the example. Landscape parks and nature reserves: Generalna Dyrekcja Ochrony Środowiska (GDOŚ). Topographic map © GUGiK.

What this example shows

Across Kraków and the Jurassic valleys to the west—highlighting Tenczyński and Bielańsko-Tyniecki landscape parks and buffer zones in yellow—GUGiK’s topographic base map and GDOŚ’s conservation overlays load as unbroken single-viewport WMS 1.3.0 images natively in EPSG:2180 with a 5 km metric scale line.

When you need it

When Polish WMS 1.3.0 services render curved buffer labels and national topographic sheets in EPSG:2180, single-image GetMap avoids cut-off tile labels while keeping true planar metres for engineering measurements.

Configuring axisOrientation: 'neu' explicitly on the OpenLayers Projection lets you use modern OGC WMS 1.3.0 natively instead of downgrading requests to legacy WMS 1.1.1.

The code

The example uses cc-openlayers, my Angular component library for OpenLayers: each aol-… element creates the OpenLayers object it names, updates it from its inputs and disposes of it with the component.

wms-image-custom-proj.shared.ts
import Projection from 'ol/proj/Projection.js';

/** The area both layers are limited to, around Poland in the national grid. */
export const EXTENT = [100000, 100000, 900000, 950000];

/** EPSG:2180 with its units, axis order and validity extent, for the view. */
export function createNationalGridProjection(): Projection {
  return new Projection({
    code: 'EPSG:2180',
    units: 'm',
    // The grid names northing first, so WMS 1.3.0 takes the bounding box in that order.
    axisOrientation: 'neu',
    extent: [144693.28, 125837.02, 876500.36, 908411.19],
  });
}
wms-image-custom-proj.ts
import { ChangeDetectionStrategy, Component, inject, PendingTasks, signal } from '@angular/core';
import {
  ControlScaleLineComponent,
  CoordinateComponent,
  DefaultControlComponent,
  DefaultInteractionComponent,
  LayerImageComponent,
  loadProj4,
  MapComponent,
  registerProjectionDefinitions,
  SourceImageWMSComponent,
  ViewComponent,
} from 'cc-openlayers';
import { createNationalGridProjection, EXTENT } from './wms-image-custom-proj.shared';

// Transparent Proj4js support:
//
// EPSG:2180 is known to Proj4js because its definition is registered by
// calling registerProjectionDefinitions(). Now when we create an
// ol/proj/Projection instance with the 'EPSG:2180' code, OpenLayers will pick
// up the transform functions from Proj4js.
//
// Note that we are setting the projection's extent here, which is used to
// determine the view resolution for zoom level 0. Recommended values for a
// projection's validity extent can be found at https://epsg.io/.

/**
 * GUGiK's topographic map of Kraków and GDOŚ's landscape parks and nature reserves over it, both as single WMS images
 * in the Polish national grid (EPSG:2180), registered through proj4.
 */
@Component({
  selector: 'app-wms-image-custom-proj',
  imports: [
    ControlScaleLineComponent,
    CoordinateComponent,
    DefaultControlComponent,
    DefaultInteractionComponent,
    LayerImageComponent,
    MapComponent,
    SourceImageWMSComponent,
    ViewComponent,
  ],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    @if (ready()) {
      <aol-map height="480px">
        <aol-interaction-default />
        <aol-control-defaults />
        <aol-control-scaleline />
        <aol-view [projection]="projection" [zoom]="6" [extent]="extent">
          <aol-coordinate [x]="19.9373" [y]="50.0617" srid="EPSG:4326" />
        </aol-view>
        <aol-layer-image [extent]="extent">
          <aol-source-imagewms
            url="https://mapy.geoportal.gov.pl/wss/service/img/guest/TOPO/MapServer/WMSServer"
            crossOrigin="anonymous"
            [params]="{ LAYERS: 'Raster', FORMAT: 'image/jpeg' }"
            attributions="Topographic map © GUGiK"
          />
        </aol-layer-image>
        <aol-layer-image [extent]="extent">
          <aol-source-imagewms
            url="https://sdi.gdos.gov.pl/wms"
            crossOrigin="anonymous"
            [params]="{ LAYERS: 'GDOS:ParkiKrajobrazowe,GDOS:Rezerwaty' }"
            serverType="geoserver"
            attributions="Landscape parks and nature reserves © GDOŚ"
          />
        </aol-layer-image>
      </aol-map>
    }
  `,
})
export class WmsImageCustomProj {
  /** True once EPSG:2180 is known to Proj4js, before the view is created. */
  readonly ready = signal(false);
  protected readonly projection = createNationalGridProjection();
  protected readonly extent = EXTENT;

  constructor() {
    void inject(PendingTasks).run(async () => {
      registerProjectionDefinitions(await loadProj4(), {
        'EPSG:2180':
          '+proj=tmerc +lat_0=0 +lon_0=19 +k=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +units=m +no_defs',
      });
      this.ready.set(true);
    });
  }
}

Architecture and OpenLayers mechanics

projection constructs new Projection({ for EPSG:2180 in metres with axisOrientation: 'neu' (North, East, Up) and extent bounds, backed by proj4 math via registerProjectionDefinitions.

Because the projection declares northing-first axes, each aol-source-imagewms automatically serialises WMS 1.3.0 BBOX values northing-first as GUGiK and GDOŚ (GDOS:ParkiKrajobrazowe,GDOS:Rezerwaty, serverType="geoserver") expect.

How it works

  • projection instantiates new Projection({ for EPSG:2180 with axisOrientation: 'neu', paired with registerProjectionDefinitions.
  • The projection’s own validity extent sets the zoom-0 scale ([zoom]="6" ≈ 48 m/px), while a separate view extent clips navigation.
  • Each aol-source-imagewms sends WMS 1.3.0 requests with northing-first bounding boxes matching axisOrientation: 'neu'.
  • serverType="geoserver" scales GDOŚ’s GDOS:ParkiKrajobrazowe,GDOS:Rezerwaty overlay to screen pixel density with matching DPI.

Pitfalls

  • Registering EPSG:2180 from a bare proj4 string alone defaults axisOrientation to 'enu' (East-first), causing WMS 1.3.0 BBOX coordinates to arrive swapped and miss Poland completely—always set axisOrientation: 'neu' (or +axis=neu) for WMS 1.3.0.
  • Default 1.5× single-image overscan absorbs short drags without network traffic, while zooms and wider pans request a fresh viewport render.

The same feature in the OpenLayers examples .

Background: state and lifecycle of maps in Angular with OpenLayers, which the components of cc-openlayers take care of.