Projections · Angular, React and OpenLayers
A map in EPSG:4326
Configure a native geographic EPSG:4326 OpenLayers map view over southern Poland with WMS 1.3.0 JPEG tiles and an arc-degree ScaleLine control.

What this example shows
Spanning southern Poland from Opole and Upper Silesia through Kraków to Rzeszów and the Tatra Mountains at [zoom]="8", GUGiK’s national topographic WMS streams natively in geographic EPSG:4326 degrees—paired with a bottom-left scale line calibrated in arc-degrees, minutes and seconds.
When you need it
INSPIRE compliance portals, defence/aviation systems, global meteorological dashboards and scientific catalogues built natively around EPSG:4326 WGS 84 services work directly in decimal degrees without Spherical Mercator projection distortion.
Matching projection="EPSG:4326" on the View with an EPSG:4326-capable WMS avoids client-side raster reprojection altogether.
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.
epsg-4326.tsimport { ChangeDetectionStrategy, Component } from '@angular/core';
import {
ControlScaleLineComponent,
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
LayerTileComponent,
MapComponent,
SourceTileWMSComponent,
ViewComponent,
} from 'cc-openlayers';
/** A map whose view is in EPSG:4326, showing GUGiK's topographic map WMS with a scale line in degrees. */
@Component({
selector: 'app-epsg-4326',
imports: [
ControlScaleLineComponent,
CoordinateComponent,
DefaultControlComponent,
DefaultInteractionComponent,
LayerTileComponent,
MapComponent,
SourceTileWMSComponent,
ViewComponent,
],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<aol-map height="480px">
<aol-interaction-default />
<aol-control-defaults />
<aol-control-scaleline units="degrees" />
<aol-view projection="EPSG:4326" [zoom]="8">
<aol-coordinate [x]="19.9368" [y]="50.0614" srid="EPSG:4326" />
</aol-view>
<aol-layer-tile>
<!-- JPEG tiles: in PNG, OpenLayers asks for a transparent background, and the map's open land comes out empty. -->
<aol-source-tilewms
url="https://mapy.geoportal.gov.pl/wss/service/img/guest/TOPO/MapServer/WMSServer"
[params]="{ LAYERS: 'Raster', FORMAT: 'image/jpeg' }"
attributions="Topographic map © GUGiK"
/>
</aol-layer-tile>
</aol-map>
`,
})
export class Epsg4326 {} 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.
epsg-4326.react.tsximport {
Coordinate,
DefaultControls,
DefaultInteractions,
Map,
ScaleLineControl,
TileLayer,
TileWMSSource,
View,
} from 'cc-openlayers/react';
const PARAMS = { LAYERS: 'Raster', FORMAT: 'image/jpeg' };
/** A map whose view is in EPSG:4326, showing GUGiK's topographic map WMS with a scale line in degrees. */
export function Epsg4326() {
return (
<Map height="480px">
<DefaultInteractions />
<DefaultControls />
<ScaleLineControl units="degrees" />
<View projection="EPSG:4326" zoom={8}>
<Coordinate x={19.9368} y={50.0614} srid="EPSG:4326" />
</View>
<TileLayer>
{/* JPEG tiles: in PNG, OpenLayers asks for a transparent background, and the map's open land comes out empty. */}
<TileWMSSource
url="https://mapy.geoportal.gov.pl/wss/service/img/guest/TOPO/MapServer/WMSServer"
params={PARAMS}
attributions="Topographic map © GUGiK"
/>
</TileLayer>
</Map>
);
}How the React version works
GUGiK's topographic map of southern Poland in a view in EPSG:4326, drawn by the WMS in that system, with a scale line in degrees.
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. The example has no shared file; its WMS parameters are a module constant in React.
From Angular to React
| Angular | React |
|---|---|
<aol-view projection="EPSG:4326" [zoom]="8"> | <View projection="EPSG:4326" zoom={8}> |
<aol-control-scaleline units="degrees" /> | <ScaleLineControl units="degrees" /> |
<aol-source-tilewms [params]="{ LAYERS: 'Raster', FORMAT: 'image/jpeg' }"> | <TileWMSSource params={PARAMS}> with PARAMS defined once at module level |
<aol-coordinate [x] [y] srid="EPSG:4326" /> inside the view | <Coordinate x y srid="EPSG:4326" /> inside View |
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
Setting projection="EPSG:4326" on aol-view switches the map to OpenLayers’ built-in equirectangular WGS 84 CRS (where zoom 0 spans 360° across 256 pixels, making [zoom]="8" ~0.0055°/px or ~600 m N–S).
The tiled WMS inherits EPSG:4326 from the view—automatically formatting WMS 1.3.0 BBOX coordinates latitude-first and requesting opaque FORMAT: 'image/jpeg' tiles—while <aol-control-scaleline units="degrees" /> displays angular scale.
How it works
projection="EPSG:4326"configuresaol-viewin geographic degrees using OpenLayers’ built-in WGS 84 definition (no proj4 needed).- At
[zoom]="8", resolution is ~0.0055° per pixel (~600 m north–south). - Tiled WMS inherits
EPSG:4326from the view so server-rendered tiles paint 1:1 without browser warping. <aol-control-scaleline units="degrees" />reports angular distance in degrees, arc-minutes or arc-seconds.
Pitfalls
- OGC WMS 1.3.0 mandates latitude-before-longitude BBOX axis order for
EPSG:4326(which OpenLayers handles automatically); hand-concatenated longitude-first WMS 1.3.0 URLs fetch the wrong hemisphere. - Equirectangular
EPSG:4326plots 1° of longitude (~71 km in Kraków) at the same pixel width as 1° of latitude (~111 km), visually stretching Poland ~1.56× wider east-to-west. - OpenLayers defaults WMS requests to transparent image/png, which leaves open land background transparent on GUGiK’s topographic service—specify
FORMAT: 'image/jpeg'for opaque basemap layers.
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.