Test files › Geospatial › antimeridian.geojson
Sample GeoJSON file (antimeridian)
A LineString and Polygon that cross the 180° antimeridian (longitudes near +180 and -180).
↓ Download antimeridian.geojson| Filename | antimeridian.geojson |
| Format | GeoJSON |
| Size | 592 bytes (592 bytes) |
| MIME type | application/geo+json |
| SHA-256 | b99aef5a88f6357dd081b6b9abce13070772029887c24cb474889fc637cd246d |
What this file catchesThe classic map bug: renderers that draw a horizontal line all the way across the world instead of wrapping at the date line. Also catches bbox maths that assumes min<max longitude.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
GeoJSON is [longitude, latitude], polygon rings must close, and RFC 7946 (section 3.1.9) asks for lines that cross the 180th meridian to be split, or a map draws them the long way round the world.
import json
def points(c):
if isinstance(c, list) and c and all(isinstance(v, (int, float)) for v in c):
yield c
elif isinstance(c, list):
for item in c:
yield from points(item)
def check(geom, n):
kind, coords = geom.get("type"), geom.get("coordinates") or []
for p in points(coords):
if len(p) < 2 or not (-180 <= p[0] <= 180 and -90 <= p[1] <= 90):
yield f"feature {n}: {p} is not [longitude, latitude] in range"
if kind == "Polygon":
for ring in coords:
if len(ring) < 4 or ring[0] != ring[-1]:
yield f"feature {n}: polygon ring is not closed (4+ positions, last equal to first)"
if kind in ("LineString", "Polygon"):
line = coords if kind == "LineString" else coords[0]
for a, b in zip(line, line[1:]):
if abs(a[0] - b[0]) > 180:
yield f"feature {n}: {a} to {b} crosses the antimeridian; split it"
with open("antimeridian.geojson", encoding="utf-8") as f:
features = json.load(f)["features"]
found = [p for n, feat in enumerate(features, 1) for p in check(feat.get("geometry") or {}, n)]
print(f"{len(features)} features:", "valid" if not found else f"{len(found)} problem{'s' * (len(found) != 1)}")
for p in found:
print(" " + p)Run against this file, it prints: 2 features: 1 problem
feature 1: [170, 0] to [-170, 0] crosses the antimeridian; split it
Related guides and tools
Download & verify
curl -fsSL -o "antimeridian.geojson" "https://files.hexaqa.com/geo/antimeridian.geojson"
curl -fsSL "https://files.hexaqa.com/geo/antimeridian.geojson" | sha256sum
# expect: b99aef5a88f6357dd081b6b9abce13070772029887c24cb474889fc637cd246d