4.0.0 (2026-10-08)
⚠ BREAKING CHANGES
- isPointInPolygon treats polygon edges that span more
than 180 (but less than 360) degrees of longitude as crossing the
antimeridian. Polygons that relied on such edges going the long way
around need an additional vertex in between. - computeDestinationPoint uses
earthRadius
(6,378,137 meters) as its default radius, which moves results by about
0.1%. Pass 6371000 as the fourth argument to get the previous results. - getDistanceFromLine now rounds its result to the given
accuracy (1 meter by default) and returns more precise values. Pass an
accuracy of 0 to get the unrounded distance. - The
geolib/es/*andgeolib/lib/*deep imports are
gone. Import named functions from the package root instead, e.g.
import { getDistance } from 'geolib', which is fully tree-shakeable
now. The browser build moved fromlib/index.jsto
dist/geolib.iife.jsand no longer supports AMD loaders. There is no
default export: useimport * as geolib from 'geolib'instead of
import geolib from 'geolib'. The output targets ES2020, so very old
browsers such as Internet Explorer are no longer supported, and the type
definitions require TypeScript 4.7 or newer.
Features
- add getIntersectionOfLines (2b761cb), closes #173
- add isPointInBoundingBox (3268eb8), closes #273
- export the TypeScript types from the package entry (9d398d5)
- keep the type of the points in orderByDistance and findNearest (53d4d8a), closes #198
- return the unrounded distance for an accuracy of 0 (0d66b24), closes #306
Fixes
- compare the unrounded distance in isPointNearLine (33d5e69)
- compare the unrounded distance in isPointWithinRadius (dcfbb67)
- default convertArea to square meters (77e336b)
- make isPointInLine precise for long and short lines (e5d5a63), closes #237 #237
- parse WKT polygons regardless of whitespace and parentheses (225fc59), closes #310
- return false from validators instead of throwing on null (00a7095), closes #307
- round only the result of getDistanceFromLine (e02175c), closes #298
- support polygons that cross the antimeridian in isPointInPolygon (76d1960), closes #38
- use the haversine formula in getDistance as documented (2b59dd6)
- use the library's earth radius in computeDestinationPoint (2702164), closes #290
Improvements
- calculate each distance only once in orderByDistance (155e086), closes #206
- make the unit conversion tables tree-shakeable (1cf06c8)
- name functions after their exports (d4c8f85)
- read each polygon vertex only once in isPointInPolygon (aa869d8), closes #202
- read numeric coordinates without string conversion (87ad9b3), closes #232
- run type checks and related tests in the pre-commit hook (8817eb9)