Socket
Book a DemoInstallSign in
Socket

@mapbox/geojson-extent

Package Overview
Dependencies
Maintainers
14
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/geojson-extent

compute the bounding box of geojson features

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
170K
-1.54%
Maintainers
14
Weekly downloads
 
Created

What is @mapbox/geojson-extent?

@mapbox/geojson-extent is an npm package that provides utilities for calculating the bounding box of GeoJSON objects. It is useful for determining the spatial extent of geographic data represented in GeoJSON format.

What are @mapbox/geojson-extent's main functionalities?

Calculate Bounding Box

This feature allows you to calculate the bounding box of a GeoJSON object. The bounding box is represented as an array of four numbers: [minX, minY, maxX, maxY].

const geojsonExtent = require('@mapbox/geojson-extent');
const geojson = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.5]
      },
      "properties": {
        "prop0": "value0"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [102.0, 0.0],
          [103.0, 1.0],
          [104.0, 0.0],
          [105.0, 1.0]
        ]
      },
      "properties": {
        "prop0": "value0",
        "prop1": 0.0
      }
    }
  ]
};
const bbox = geojsonExtent(geojson);
console.log(bbox); // Output: [102, 0, 105, 1]

Other packages similar to @mapbox/geojson-extent

Keywords

geojson

FAQs

Package last updated on 14 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts