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.

Two maps side by side over OpenStreetMap: on the left, in EPSG:4326, round circles at the equator turning into wide ellipses towards the poles; on the right, in Web Mercator, circles that stay round and grow larger towards Scandinavia.
A screenshot of the example. Map data © OpenStreetMap contributors.

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.ts
import 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.ts
import { 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;
}

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 (radius 800 km, 64 vertices) on a 30° global grid via circular([x, y], radius, 64).
  • loadGeographic mounts the degree polygons directly onto the projection="EPSG:4326" map.
  • loadWebMercator projects each polygon via circle.transform('EPSG:4326', 'EPSG:3857') onto the Web Mercator map.
  • Both maps open at [zoom]="2" over Kraków with distinct ariaLabel names for assistive technologies.

Pitfalls

  • At 60° N latitude (sec(60°) = 2), EPSG:4326 stretches 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 circular is essential because transform projects vertices only and draws straight projected segments between them.

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.