geojson-extent

Computes the bounding extent of a GeoJSON object. It is commonly used to frame a map or static map image around some data.

Share on XLicense: ISC

Overview

geojson-extent computes the bounding extent of a GeoJSON object. The main function returns bounds in west, south, east, north order, and invalid input returns null. Related helpers return the bounds as a GeoJSON polygon or add bounding boxes to the object. It also ships a command line tool that reads GeoJSON from stdin and prints the extent, with an option for Leaflet format. It is often used to frame a map or static map image around data.

Key features

  • extent() returns bounds as [west, south, east, north]
  • extent.polygon() returns the bounds as a GeoJSON polygon
  • extent.bboxify() adds bounding boxes to GeoJSON
  • Command line tool reads GeoJSON from stdin

Best for

Developers who need to zoom a map or build a static map image to fit their GeoJSON data.

Upstream
mapbox/geojson-extent
Fork on GitHub
Guo-astro/geojson-extent
Upstream stars
73
Category
Maps and geospatial
Language
JavaScript
License
ISC
Forked
2020-11-01
Sync status
In syncLast synced 2026-09-29