Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bbox2extent

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bbox2extent

Transform a GeoJSON bounding box into an Esri-formatted extent object.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
252
decreased by-41.53%
Maintainers
3
Weekly downloads
 
Created
Source

bbox2extent

Transform a GeoJSON bounding box into an Esri-formatted extent object.

Install

npm install bbox2extent

Usage

var bbox2extent = require('bbox2exent')
var bbox = [100, 0, 105, 1]

var extent = bbox2extent(bbox)
// {
//   xmin: 100,
//   ymin: 0,
//   xmax: 105,
//   ymax: 1,
//   spatialReference: {
//     wkid: 4326,
//     latestWkid: 4326
//   }
// }

// -- OR --

bbox2extent(bbox, function (err, extent) {
  if (err) throw err

  console.log(extent)
  // {
  //   xmin: 100,
  //   ymin: 0,
  //   xmax: 105,
  //   ymax: 1,
  //   spatialReference: {
  //     wkid: 4326,
  //     latestWkid: 4326
  //   }
  // }
})

Also supports reverse operation (converting an extent to a bounding box) via reverse:

var extent2bbox = require('bbox2extent').reverse
var extent = {
  xmin: -108.9395,
  ymin: 37.084968,
  xmax: -102,
  ymax: 40.8877,
  spatialReference: {
    wkid: 4326,
    latestWkid: 4326
  }
}

var bbox = extent2bbox(extent)
// [ -108.9395, 37.084968, -102, 40.8877 ]

// -- OR --

extent2bbox(extent, function (err, bbox) {
  if (err) throw err

  console.log(bbox)
  // [ -108.9395, 37.084968, -102, 40.8877 ]
})

Contributing

bbox2extent is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See the CONTRIBUTING.md file for more details.

License

ISC

Keywords

FAQs

Package last updated on 03 Aug 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc