Tile and image services · Angular, React and OpenLayers

One map image from OGC API - Maps

Render single-image regional maps from an OGC API - Maps /map endpoint in OpenLayers with HiDPI mm-per-pixel scaling and generous pan overscan.

Lesser Poland and Upper Silesia at zoom 9 in EuroGeographics' EuroRegionalMap, from Katowice to Tarnów, with Kraków in the middle.
A screenshot of the example. EuroRegionalMap © EuroGeographics, served by CubeWerx's OGC API demonstration server.

What this example shows

Spanning Lesser Poland and Upper Silesia from Katowice through Kraków to Tarnów at zoom 9, EuroGeographics’ EuroRegionalMap renders as one seamless, label-collision-free image per viewport fetched from an OGC API - Maps service.

When you need it

OGC API - Maps is the modern RESTful successor to classic WMS GetMap—ideal for cartographically rich maps where server-side label placement across the whole viewport avoids cut-off tile-edge text.

Built-in physical pixel-pitch negotiation (mm-per-pixel) also standardises high-DPI Retina rendering across compliant servers without vendor-specific MAP_RESOLUTION or FORMAT_OPTIONS parameters.

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-maps.ts
import { ChangeDetectionStrategy, Component } from '@angular/core';
import {
  CoordinateComponent,
  DefaultControlComponent,
  DefaultInteractionComponent,
  LayerImageComponent,
  MapComponent,
  SourceOGCMapComponent,
  ViewComponent,
} from 'cc-openlayers';

/** EuroGeographics' EuroRegionalMap on CubeWerx's OGC API demonstration server. */
const EURO_REGIONAL_MAP = 'https://test.cubewerx.com/cubewerx/cubeserv/demo/ogcapi/EuroRegionalMap';

/**
 * EuroGeographics' EuroRegionalMap of Lesser Poland and Upper Silesia, around Kraków, as one image per view from an
 * OGC API - Maps service.
 */
@Component({
  selector: 'app-ogc-maps',
  imports: [
    CoordinateComponent,
    DefaultControlComponent,
    DefaultInteractionComponent,
    LayerImageComponent,
    MapComponent,
    SourceOGCMapComponent,
    ViewComponent,
  ],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    <aol-map height="480px">
      <aol-interaction-default />
      <aol-control-defaults />
      <aol-view [zoom]="9">
        <aol-coordinate [x]="19.9368" [y]="50.0614" srid="EPSG:4326" />
      </aol-view>
      <aol-layer-image>
        <aol-source-ogcmap [url]="url" attributions="© EuroGeographics (EuroRegionalMap)" />
      </aol-layer-image>
    </aol-map>
  `,
})
export class OgcMaps {
  protected readonly url = `${EURO_REGIONAL_MAP}/map`;
}

Architecture and OpenLayers mechanics

aol-source-ogcmap targets the dataset, collection or style /map resource directly, passing width, height, bbox, crs and bbox-crs query parameters. By default OpenLayers requests an image 1.5 times wider and taller than the screen so short pans reveal pre-rendered margin immediately.

On Retina / HiDPI screens, OpenLayers requests physical device pixel dimensions alongside mm-per-pixel (0.28 / pixelRatio), instructing the server to scale road widths, shields and typography cleanly.

How it works

  • aol-source-ogcmap queries the OGC API /map resource with width, height, bbox, crs and bbox-crs.
  • Default 1.5× overscan sizing buffers a margin around the viewport so short drags show no empty border before the next image loads.
  • HiDPI displays automatically scale pixel dimensions and send mm-per-pixel (0.28 / pixelRatio) for sharp server-rendered symbols and labels.

Pitfalls

  • Point the source URL directly at the concrete /map resource endpoint (on the dataset, collection or style)—OpenLayers does not crawl the root OGC API landing page to guess where /map lives.
  • Like single-image WMS, every pan beyond the overscan margin or zoom change triggers a fresh server render while temporarily stretching the previous image.

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.