All Projects → mapbox → Geojson Extent

mapbox / Geojson Extent

Licence: isc
Compute an extent given a GeoJSON object.

Programming Languages

javascript
184084 projects - #8 most used programming language

geojson-extent

Compute an extent given a GeoJSON object.

install

npm install --save @mapbox/geojson-extent

example

Live example with Mapbox Static Map API

var geojsonExtent = require('geojson-extent');

geojsonExtent({ type: 'Point', coordinates: [0, 0] }); // returns 0,0,0,0 extent

bin

Provides a binary that takes GeoJSON as stdin and returns a JSON stringified array of extent data.

$ npm install -g geojson-extent
$ geojson-extent < file.geojson

Given an argument of leaflet, this will return Leaflet-formatted data instead.

$ geojson-extent leaflet < file.geojson

api

extent(geojson)

Given any valid GeoJSON object, return bounds in the form [WSEN]. Invalid objects will return null.

extent.polygon(geojson)

Given any valid GeoJSON object, return bounds in the form of a GeoJSON polygon object. Invalid objects will return null.

extent.bboxify(geojson)

Add bounding boxes to all appropriate GeoJSON objects - Feature, FeatureCollection, and Geometry.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].