1.2.1 • Published 9 years ago
bbox-dateline v1.2.1
BBox Date Line
Modifies a BBox to fit within 180° longitude & 90° latitude.
Install
$ yarn add bbox-datelineUsage
const dateline = require('bbox-dateline')
dateline.bbox([190, 100, -200, -120])
//= [-170, -80, 160, 60]API
Table of Contents
bbox
Modifies a BBox to fit within the bounds of the International Date Line.
Parameters
bbox(BBox | FeatureCollection | Feature<any>) BBox west, south, east, north or GeoJSON Feature
Examples
dateline.bbox([190, 100, -200, -120])
//= [-170, -80, 160, 60]Returns BBox valid BBox extent
center
Modifies a Center to fit within the bounds of the International Date Line.
Parameters
coord([number, number] | BBox | FeatureCollection | Feature<any>) Center lng, lat, BBox west, south, east, south or GeoJSON Feature
Examples
dateline.center([190, 100])
//= [-170, -80]Returns [number, number] valid center coordinate
latitude
Modifies a Latitude to fit within +/-90 degrees.
Parameters
latnumber latitude to modify
Examples
dateline.latitude(100)
//= -80Returns number modified latitude
longitude
Modifies a Longitude to fit within +/-180 degrees.
Parameters
lngnumber longitude to modify
Examples
dateline.longitude(190)
//= -170Returns number modified longitude