OpenLayers

OpenLayers renders maps in the browser: raster tiles, vector layers, WMS and WMTS services, and interactive behaviour on top. It is heavier and more capable than Leaflet, which is the usual alternative.

The reason I use it for environmental data is narrow and decisive: it handles projections properly.

Why that matters more than it sounds

Leaflet assumes Web Mercator. For a general-purpose slippy map that is fine, since every commercial tile provider uses it.

Scientific and governmental geospatial data does not. National mapping agencies publish in national grids, climate model output arrives on rotated poles or regular lat-lon, and environmental datasets come in whatever reference system the producing institution uses. Reprojecting everything to Web Mercator before display means a preprocessing step, resampling loss, and area distortion that grows toward the poles.

OpenLayers can display data in its native projection and reproject on the fly through proj4. For a portal serving data in the projection it was produced in, that removes an entire preprocessing pipeline.

The failure mode this avoids is worth naming, because it is quiet. A projection mismatch does not produce an error — it produces a map that renders, looks plausible, and places features in the wrong location. Coastlines slightly offset from where they should be is a symptom easy to attribute to data quality rather than to a configuration mistake.

What it costs

The API is larger and more explicit than Leaflet’s. Creating a map means constructing sources, layers, views, and interactions rather than calling one constructor with options. That verbosity is the price of the flexibility and it is felt immediately, in the first hour.

Bundle size is substantial, though tree shaking helps if imports are selective.

For a simple marker map, Leaflet is the right answer and OpenLayers is over-engineering. The moment projections, WMS services, or large vector datasets are involved, the balance reverses — and it reverses sharply rather than gradually.

A note on vector performance

Rendering many thousands of vector features degrades noticeably. Vector tiles are the answer, moving the simplification server-side, and this is a design decision to take before the dataset grows rather than a fix to apply afterwards.

See also: spatial reference systems, PostGIS for the server side, QGIS for the desktop equivalent, and the UCO portal.