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.

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.tsimport { 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`;
} The React version uses the library's React adapter, cc-openlayers/react: each component creates the OpenLayers object it names when it mounts, updates it from its props and disposes of it when it unmounts.
ogc-maps.react.tsximport {
Coordinate,
DefaultControls,
DefaultInteractions,
ImageLayer,
Map,
OGCMapSource,
View,
} from 'cc-openlayers/react';
/** EuroGeographics' EuroRegionalMap on CubeWerx's OGC API demonstration server. */
const EURO_REGIONAL_MAP = 'https://test.cubewerx.com/cubewerx/cubeserv/demo/ogcapi/EuroRegionalMap';
const url = `${EURO_REGIONAL_MAP}/map`;
/**
* EuroGeographics' EuroRegionalMap of Lesser Poland and Upper Silesia, around Kraków, as one image per view from an
* OGC API - Maps service.
*/
export function OgcMaps() {
return (
<Map height="480px">
<DefaultInteractions />
<DefaultControls />
<View zoom={9}>
<Coordinate x={19.9368} y={50.0614} srid="EPSG:4326" />
</View>
<ImageLayer>
<OGCMapSource url={url} attributions="© EuroGeographics (EuroRegionalMap)" />
</ImageLayer>
</Map>
);
}How the React version works
EuroRegionalMap from CubeWerx's demo server as OGC API – Maps images.
What both versions share
OpenLayers renders the map and handles the interactions; the cc-openlayers/core layer gives both adapters the same view binding (MapViewBinding) and the same conversion of coordinates from EPSG:4326 to the map's projection.
From Angular to React
| Angular | React |
|---|---|
<aol-layer-image> with <aol-source-ogcmap> | <ImageLayer> with <OGCMapSource> |
Who creates, updates and disposes
Map creates the ol/Map in useLayoutEffect and disposes of it on unmount; each layer, source and interaction component adds its object to the parent it gets from context and removes it in its effect's cleanup, as ngOnDestroy does in Angular.
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-ogcmapqueries the OGC API/mapresource 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
/mapresource endpoint (on the dataset, collection or style)—OpenLayers does not crawl the root OGC API landing page to guess where/maplives. - Like single-image WMS, every pan beyond the overscan margin or zoom change triggers a fresh server render while temporarily stretching the previous image.
Related examples
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.