Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including geobound-object with all npm packages installed. Try it out:

var geoboundObject = require("geobound-object")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

geobound-object v0.1.2

convert different type of arrays to a unified bound object with getter methods


This package provides a constructor to create bound objects, specific for geographic usage. The style is similar to Leaflet's LatLngBound object, with much less functionality (and with arrays instead of LatLng elements returned). It can be used if you need to define unique bounds with variable input. This package is used as output format of osmtile2bound and as input format for bound2osmtile.


Use standard npm installation

npm install --save geobound-object


This package provides a constructor only. This constructor has to be called with the new statement. If invalid properties are passed, the constructor throws an error.

Input parameter

There are many different types of allowed inputs

Edge - Array

// [north, east, south, west]
new Bound([48.1354432, 11.6037082, 48.123412, 11.621389]);

// output: Bound object

Bound - Array

// [[north east], [south west]]
new Bound([[48.1354432, 11.6037082], [48.123412, 11.621389]]);

// output: Bound object

Bound - LatLng Array

// [LatLng, LatLng]
new Bound([L.latLng([48.1354432, 11.6037082]), L.latLng([48.123412, 11.621389])]);

// output: Bound object

LatLngBound or Identity

new Bound(new Bound([48.1354432, 11.6037082, 48.123412, 11.621389]));

// output: Bound object

Bound Object

The returned bound object has several getter methods.

  • getNorth() - Number, north point
  • getEast() - Number, east point
  • getSouth() - Number, south point
  • getWest() - Number, west point
  • getSouthWest - [Number, Number], [south, west]
  • getNorthWest - [Number, Number], [north, west]
  • getNorthEast - [Number, Number], [north, east]
  • getSouthEast - [Number, Number], [south, east]
  • getCenter - [Number, Number], [lat, lng] of center of the bounds


Feel free to add issues or pull requests. I'm glad for every kind of feedback!


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free