开发者社区> 镜像站> NPM> geojson-extent
geojson-extent

compute the bounding box of geojson features

This module has moved: please switch to @mapbox/geojson-extent
Last updated 5 years ago by tmcw .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install geojson-extent 
SYNC missed versions from official npm registry.

geojson-extent

Compute an extent given a GeoJSON object.

install

npm install --save 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.

Current Tags

  • 0.3.2                                ...           latest (5 years ago)

7 Versions

  • 0.3.2 [deprecated]           ...           5 years ago
  • 0.3.1 [deprecated]           ...           6 years ago
  • 0.3.0 [deprecated]           ...           6 years ago
  • 0.2.0 [deprecated]           ...           6 years ago
  • 0.1.0 [deprecated]           ...           6 years ago
  • 0.0.1 [deprecated]           ...           7 years ago
  • 0.0.0 [deprecated]           ...           7 years ago