gmb

geojson-minimum-bounding-rectangle

A library to compute the Minimum Bounding Rectangle of a GeoJSON polygon

Showing:

Popularity

Downloads/wk

833

GitHub Stars

9

Maintenance

Last Commit

10mos ago

Contributors

2

Package

Dependencies

9

Size (min+gzip)

10.8KB

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

npm version

Minimum Bounding Rectangle for GeoJSON

This Javascript/Typescript library provides 2 methods for calculating the Minimum Bounding Rectangle by area and by width for a given GeoJSON feature or feature collection.

This problem it is solving has many names: Minimum Bounding Rectangle, Minimum Bounding Box, Smallest Surrounding Rectangle, Minimum Area Rectangle...

Example

This is an example of the output of this library. The input GeoJSON is the yellow polygon (outline of the Republic of Ireland).

The blue rectangle was generated by smallestSurroundingRectangleByWidth while the red rectangle is the output of smallestSurroundingRectangleByArea

example image

How to use it

Installation

yarn add geojson-minimum-bounding-rectangle

or

npm install geojson-minimum-bounding-rectangle

Usage

import {
  smallestSurroundingRectangleByWidth,
  smallestSurroundingRectangleByArea,
} from "geojson-minimum-bounding-rectangle";

const boundingRect = smallestSurroundingRectangleByWidth(myGeoJsonInput);

More Information:

License

See LICENSE for more details.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100