geojson-minimum-bounding-rectangle
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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.

Package Sidebar

Install

npm i geojson-minimum-bounding-rectangle

Weekly Downloads

460

Version

1.0.1

License

MIT

Unpacked Size

383 kB

Total Files

25

Last publish

Collaborators

  • matthiasfeist