Projections · Angular, React and OpenLayers

OGC API map tiles in WorldCRS84Quad

Display GTOPO30 Carpathian shaded relief from OGC API - Tiles using the geographic WorldCRS84Quad matrix set in an EPSG:4326 OpenLayers view.

GTOPO30's shaded relief of southern Poland and northern Slovakia: the Carpathians as a yellow band across the lower half with the Tatras in red, the lowlands around Kraków in green and the Kraków–Częstochowa Upland in yellow above them.
A screenshot of the example. GTOPO30 shaded relief: U.S. Geological Survey, served by CubeWerx's OGC API demonstration server.

What this example shows

Centred south of Kraków ([x]="19.94" [y]="49.75") at [zoom]="8" to frame the Kraków–Częstochowa Upland, Podhale basin and high Tatra peaks along the Slovak border, classic GTOPO30 elevation relief streams as WorldCRS84Quad map tiles directly into a native EPSG:4326 view without client reprojection.

When you need it

When an OGC API - Tiles server publishes both WebMercatorQuad and geographic WorldCRS84Quad pyramids, pairing an EPSG:4326 map view with WorldCRS84Quad avoids browser tile warping and preserves sharp server-rendered pixels.

Understanding the 1-level zoom offset between OpenLayers’ default EPSG:4326 view and OGC’s WorldCRS84Quad standard clarifies how resolution ladders align.

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.

ogc-map-tiles-geographic.ts
import { ChangeDetectionStrategy, Component } from '@angular/core';
import {
  CoordinateComponent,
  DefaultControlComponent,
  DefaultInteractionComponent,
  LayerTileComponent,
  MapComponent,
  SourceOGCMapTileComponent,
  ViewComponent,
} from 'cc-openlayers';

/**
 * The GTOPO30 shaded relief around Kraków as map tiles from an OGC API - Tiles service in the geographic WorldCRS84Quad
 * tile matrix set, shown in a geographic view. The tileset lies in the gallery's assets: its tiles are CubeWerx's, but
 * the server's own description names the axes latitude first and gives the origin longitude first, which OpenLayers
 * reads swapped.
 */
@Component({
  selector: 'app-ogc-map-tiles-geographic',
  imports: [
    CoordinateComponent,
    DefaultControlComponent,
    DefaultInteractionComponent,
    LayerTileComponent,
    MapComponent,
    SourceOGCMapTileComponent,
    ViewComponent,
  ],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    <aol-map height="480px">
      <aol-interaction-default />
      <aol-control-defaults />
      <aol-view projection="EPSG:4326" [zoom]="8">
        <aol-coordinate [x]="19.94" [y]="49.75" srid="EPSG:4326" />
      </aol-view>
      <aol-layer-tile>
        <aol-source-ogcmaptile
          [url]="url"
          projection="EPSG:4326"
          attributions="GTOPO30: U.S. Geological Survey; tiles: CubeWerx"
        />
      </aol-layer-tile>
    </aol-map>
  `,
})
export class OgcMapTilesGeographic {
  /** The tileset document, as an absolute URL: OpenLayers resolves the tile links against it. */
  protected readonly url = new URL('assets/ogc/relief-WorldCRS84Quad.json', document.baseURI).href;
}

Architecture and OpenLayers mechanics

aol-source-ogcmaptile reads a local tileset JSON descriptor at [url]="url" (with corrected longitude-first axis metadata pointing at CubeWerx’s GTOPO30 tile endpoint) and configures projection="EPSG:4326" to match the view.

Because OpenLayers’ EPSG:4326 view starts zoom 0 as one 256 px tile spanning 360° (1.40625°/px) whereas OGC WorldCRS84Quad starts matrix 0 as two 256 px tiles (0.703125°/px), [zoom]="8" (~0.0055°/px) cleanly requests matrix level 7.

How it works

  • aol-source-ogcmaptile parses the WorldCRS84Quad tileset JSON at [url]="url" with projection="EPSG:4326".
  • Bundled JSON metadata fixes the upstream axis declaration while linking live GTOPO30 relief tiles.
  • View [zoom]="8" (0.0055°/px) maps 1:1 to WorldCRS84Quad matrix 7 because WorldCRS84Quad starts with two world tiles at level 0.
  • Centring at [x]="19.94" [y]="49.75" frames both Kraków and the Tatra Mountains.

Pitfalls

  • OpenLayers interprets a tile matrix’s pointOfOrigin according to the orderedAxes declared in the TileMatrixSet JSON—if an upstream server declares Lat, Long axes while writing [-180, 90] longitude-first, OpenLayers swaps the origin into the wrong corner unless corrected.

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.