npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

boundingbox-split

v1.0.1

Published

Split a bounding box into 4^n equal smaller bounding boxes

Downloads

76

Readme

Build Status

Boundingbox-split

A Node.js script that for splitting a bounding box into 4^n equal smaller bounding boxes.

Prerequisites

Node.js - Version >=4.3.2

Installation

Use npm:

$ npm install boundingbox-split --save

Or you can clone and install HEAD:

git clone https://github.com/tekdreams/boundingbox-split.git
cd boundingbox-split
npm install

Getting Started

const bbox = require(boundingbox-split);

The method boundingBoxCutting takes two parameters:

  • A number n => The bounding box will be splitted into 4^n equal small bounding boxes.

  • The coordinates of the main bounding box to split

const boxParameters = {
  centerLat : centerLat box coordinate,
  centerLng : centerLng box coordinate,
  maxLat : maxLat box coordinate,
  minLat : minLat box coordinate,
  maxLng : maxLng box coordinate,
  minLng : minLng box coordinate
}

Example:

const boxParameters = {
  centerLat : 2.352221900000177,
  centerLng : 48.856614,
  maxLat : 48.815573,
  minLat : 48.9021449,
  maxLng : 2.22519299999999,
  minLng : 2.4699207999999544
}

Usage

This wrapper utilizes ES6 Promises to handle the API calls. To split a bounding box into 4^n use the following...

bbox.boundingBoxCutting(boxParameters, n)
.then(result => console.log(result))
.catch(error => console.log(error))

The result returned in from the promise will be a Result array (with the same main Bbox format).

Additional information

I've made this module for my personal needs. I just needed to get 4^8 = 65536 bounding boxes maximum.

If you need more bounding boxes, the script will take some times to be executed. It may also consumes all available JS heap space during its processing. You’ll receive an error output and message like this:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

The solution to run your Node.js app with increased memory is to start the process with an additional V8 flag: --max-old-space-size. You need to append your desired memory size in megabytes.

Tests

npm test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

Copyright © 2017 Tekdreams. MIT Licensed.