Tile and image services · Angular, React and OpenLayers
Map tiles from OGC API - Tiles
Load EuroGeographics raster tiles from an OGC API - Tiles JSON service in OpenLayers with aol-source-ogcmaptile and explicit CRS projection.

What this example shows
Centred on Kraków at zoom 11—framing the A4 motorway bypass, the Vistula river and Balice airport—EuroGeographics’ cartographic EuroRegionalMap streams directly from a modern JSON-based OGC API - Tiles server.
When you need it
OGC API - Tiles is the modern REST/JSON successor to XML-heavy WMTS, adopted across next-generation European INSPIRE nodes, pygeoapi, CubeWerx and LDProxy deployments.
Instead of parsing verbose XML capability trees or handcrafting matrix grids, pointing OpenLayers at the JSON tileset endpoint discovers the tile matrix set and item URL template automatically.
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.tsimport { ChangeDetectionStrategy, Component } from '@angular/core';
import {
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
LayerTileComponent,
MapComponent,
SourceOGCMapTileComponent,
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 around Kraków as map tiles from an OGC API - Tiles service. */
@Component({
selector: 'app-ogc-map-tiles',
imports: [
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
LayerTileComponent,
MapComponent,
SourceOGCMapTileComponent,
ViewComponent,
],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<aol-map height="480px">
<aol-interaction-default />
<aol-control-defaults />
<aol-view [zoom]="11">
<aol-coordinate [x]="19.9368" [y]="50.0614" srid="EPSG:4326" />
</aol-view>
<aol-layer-tile>
<!-- The service names its CRS with a URI OpenLayers cannot resolve: the projection is given instead. -->
<aol-source-ogcmaptile [url]="url" projection="EPSG:3857" attributions="© EuroGeographics (EuroRegionalMap)" />
</aol-layer-tile>
</aol-map>
`,
})
export class OgcMapTiles {
/** The map tiles of the default style in the service's Web Mercator tile matrix set. */
protected readonly url = `${EURO_REGIONAL_MAP}/collections/erm/styles/default/map/tiles/euro_3857`;
} 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-map-tiles.react.tsximport {
Coordinate,
DefaultControls,
DefaultInteractions,
Map,
OGCMapTileSource,
TileLayer,
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';
/** The map tiles of the default style in the service's Web Mercator tile matrix set. */
const url = `${EURO_REGIONAL_MAP}/collections/erm/styles/default/map/tiles/euro_3857`;
/** EuroGeographics' EuroRegionalMap around Kraków as map tiles from an OGC API - Tiles service. */
export function OgcMapTiles() {
return (
<Map height="480px">
<DefaultInteractions />
<DefaultControls />
<View zoom={11}>
<Coordinate x={19.9368} y={50.0614} srid="EPSG:4326" />
</View>
<TileLayer>
{/* The service names its CRS with a URI OpenLayers cannot resolve: the projection is given instead. */}
<OGCMapTileSource url={url} projection="EPSG:3857" attributions="© EuroGeographics (EuroRegionalMap)" />
</TileLayer>
</Map>
);
}How the React version works
EuroGeographics' EuroRegionalMap around Kraków as map tiles from an OGC API – Tiles service.
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-source-ogcmaptile [url]> | <OGCMapTileSource url> |
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-ogcmaptile fetches the JSON tileset descriptor at [url] (here the default style’s Web Mercator tileset), follows its tile matrix set link, and extracts the raster tile URL template from its item link relation.
Supplying explicit projection="EPSG:3857" overrides a CRS identifier that OpenLayers cannot resolve on its own, so the tiles line up with the Web Mercator view.
How it works
aol-source-ogcmaptilereads both the JSON tileset metadata at[url]and its linked tile matrix set definition automatically.- The service’s own matrix set provides Web Mercator tiles aligned with standard view zoom levels.
projection="EPSG:3857"supplies a recognised CRS code where the server’s own CRS string does not resolve in OpenLayers.
Pitfalls
- Omitting
projectionwhen an OGC API - Tiles server emits a non-standard CRS URI causes OpenLayers to log an Unsupported CRS error during metadata setup and leave the layer blank. - When a tileset omits per-level tileMatrixSetLimits, OpenLayers will request tiles anywhere in the world—add a geographic [extent] on the layer to avoid requesting empty tiles outside Europe.
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.