Projections · Angular, React and OpenLayers
Tissot's indicatrices in two projections
Compare angular and area map distortion side by side between EPSG:4326 and Web Mercator in OpenLayers using 84 spherical Tissot indicatrices.

What this example shows
Two accessible (ariaLabel) OpenStreetMap views open side by side at [zoom]="2" centred on Kraków’s meridian—EPSG:4326 on the left and EPSG:3857 Web Mercator on the right—each overlaid with 84 identical 800-kilometre ground circles arranged on a 30° global grid.
On the left EPSG:4326 map, circles flatten into wide horizontal ellipses toward the poles; on the right Web Mercator map, every circle stays perfectly round (conformal) while ballooning dramatically in area across Scandinavia and Greenland.
When you need it
Explaining why distances, buffers and country sizes behave differently in EPSG:4326 versus EPSG:3857 is far clearer visually than through projection formulas.
Tissot’s indicatrices—true equal-radius circles generated on the sphere—reveal local angular distortion (ellipse flattening) and area inflation (circle size) simultaneously.
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.
tissot.shared.tsimport Feature from 'ol/Feature.js';
import { circular } from 'ol/geom/Polygon.js';
import type VectorSource from 'ol/source/Vector.js';
const radius = 800000;
/** A circle of the radius, 64 segments, around every point of a 30 degree grid. */
function circles() {
const polygons = [];
for (let x = -180; x < 180; x += 30) {
for (let y = -90; y <= 90; y += 30) {
polygons.push(circular([x, y], radius, 64));
}
}
return polygons;
}
/** Feature loader of the EPSG:4326 map: the circles as they are. */
export const loadGeographic = function (this: VectorSource): void {
this.addFeatures(circles().map((circle) => new Feature(circle)));
};
/** Feature loader of the EPSG:3857 map: the circles transformed to Web Mercator. */
export const loadWebMercator = function (this: VectorSource): void {
this.addFeatures(circles().map((circle) => new Feature(circle.transform('EPSG:4326', 'EPSG:3857'))));
};tissot.tsimport { ChangeDetectionStrategy, Component } from '@angular/core';
import {
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
LayerTileComponent,
LayerVectorComponent,
MapComponent,
SourceOsmComponent,
SourceVectorComponent,
ViewComponent,
} from 'cc-openlayers';
import { loadGeographic, loadWebMercator } from './tissot.shared';
/** Circles of 800 km on a world grid, drawn on an EPSG:4326 map and an EPSG:3857 map to show their distortion. */
@Component({
selector: 'app-tissot',
imports: [
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
LayerTileComponent,
LayerVectorComponent,
MapComponent,
SourceOsmComponent,
SourceVectorComponent,
ViewComponent,
],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="example-maps">
<aol-map height="480px" ariaLabel="EPSG:4326">
<aol-interaction-default />
<aol-control-defaults />
<aol-view projection="EPSG:4326" [zoom]="2">
<aol-coordinate [x]="19.9368" [y]="50.0614" srid="EPSG:4326" />
</aol-view>
<aol-layer-tile><aol-source-osm /></aol-layer-tile>
<aol-layer-vector><aol-source-vector [loader]="loadGeographic" /></aol-layer-vector>
</aol-map>
<aol-map height="480px" ariaLabel="EPSG:3857">
<aol-interaction-default />
<aol-control-defaults />
<aol-view [zoom]="2">
<aol-coordinate [x]="19.9368" [y]="50.0614" srid="EPSG:4326" />
</aol-view>
<aol-layer-tile><aol-source-osm /></aol-layer-tile>
<aol-layer-vector><aol-source-vector [loader]="loadWebMercator" /></aol-layer-vector>
</aol-map>
</div>
`,
})
export class Tissot {
protected readonly loadGeographic = loadGeographic;
protected readonly loadWebMercator = loadWebMercator;
} 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.
tissot.react.tsximport {
Coordinate,
DefaultControls,
DefaultInteractions,
Map,
OSMSource,
TileLayer,
VectorLayer,
VectorSource,
View,
} from 'cc-openlayers/react';
import { loadGeographic, loadWebMercator } from './tissot.shared';
/** Circles of 800 km on a world grid, drawn on an EPSG:4326 map and an EPSG:3857 map to show their distortion. */
export function Tissot() {
return (
<div className="example-maps">
<Map height="480px" ariaLabel="EPSG:4326">
<DefaultInteractions />
<DefaultControls />
<View projection="EPSG:4326" zoom={2}>
<Coordinate x={19.9368} y={50.0614} srid="EPSG:4326" />
</View>
<TileLayer>
<OSMSource />
</TileLayer>
<VectorLayer>
<VectorSource loader={loadGeographic} />
</VectorLayer>
</Map>
<Map height="480px" ariaLabel="EPSG:3857">
<DefaultInteractions />
<DefaultControls />
<View zoom={2}>
<Coordinate x={19.9368} y={50.0614} srid="EPSG:4326" />
</View>
<TileLayer>
<OSMSource />
</TileLayer>
<VectorLayer>
<VectorSource loader={loadWebMercator} />
</VectorLayer>
</Map>
</div>
);
}tissot.shared.tsimport Feature from 'ol/Feature.js';
import { circular } from 'ol/geom/Polygon.js';
import type VectorSource from 'ol/source/Vector.js';
const radius = 800000;
/** A circle of the radius, 64 segments, around every point of a 30 degree grid. */
function circles() {
const polygons = [];
for (let x = -180; x < 180; x += 30) {
for (let y = -90; y <= 90; y += 30) {
polygons.push(circular([x, y], radius, 64));
}
}
return polygons;
}
/** Feature loader of the EPSG:4326 map: the circles as they are. */
export const loadGeographic = function (this: VectorSource): void {
this.addFeatures(circles().map((circle) => new Feature(circle)));
};
/** Feature loader of the EPSG:3857 map: the circles transformed to Web Mercator. */
export const loadWebMercator = function (this: VectorSource): void {
this.addFeatures(circles().map((circle) => new Feature(circle.transform('EPSG:4326', 'EPSG:3857'))));
};How the React version works
Circles of 800 km on a 30° grid over the world on an EPSG:4326 map and a Web Mercator map side by side, to compare how each projection distorts them.
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. Both versions import the two loaders, loadGeographic and loadWebMercator from the example's .shared.ts file, so the logic exists once.
From Angular to React
| Angular | React |
|---|---|
two <aol-map ariaLabel=…> in one container | two <Map ariaLabel=…> |
<aol-source-vector [loader]="loadGeographic" /> | <VectorSource loader={loadGeographic} /> |
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
circles() generates 84 spherical 64-segment (65-point) rings of radius 800 km on a 30° grid using circular([x, y], radius, 64) in EPSG:4326 degrees.
loadGeographic adds those degree polygons directly into the projection="EPSG:4326" map, whereas loadWebMercator projects each 64-vertex ring via circle.transform('EPSG:4326', 'EPSG:3857') for the Web Mercator map.
How it works
circles()builds 84 spherical polygons (radius800 km, 64 vertices) on a 30° global grid viacircular([x, y], radius, 64).loadGeographicmounts the degree polygons directly onto theprojection="EPSG:4326"map.loadWebMercatorprojects each polygon viacircle.transform('EPSG:4326', 'EPSG:3857')onto the Web Mercator map.- Both maps open at
[zoom]="2"over Kraków with distinctariaLabelnames for assistive technologies.
Pitfalls
- At 60° N latitude (sec(60°) = 2),
EPSG:4326stretches circles 2× wider than tall, whereas conformal Web Mercator stretches both X and Y by 2×—preserving circular shape while inflating Scandinavian areas to 4× (2 × 2) their equatorial screen size. - Sampling 64 vertices around each spherical circle via
circularis essential becausetransformprojects vertices only and draws straight projected segments between them.
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.