New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bbox-stream

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bbox-stream

A stream of coordinates within a bounding box.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bbox-stream

An async iterable of coordinates within a bounding box.

npm version ISC-licensed minimum Node.js version support me via GitHub Sponsors chat with me on Twitter

Installing

npm install bbox-stream

Usage

Note: If you're looking for a stream.Readable: This package does not expose it anymore, but since the Node.js stream APIs directly support (sync) iterables and async iterables, you likely won't need it.

async iterable interface

const coordsIterable = require('bbox-stream')

const it = coordsIterable([52.4, 13.4, 52.6, 13.6], .1)
for await (const coords of it) console.log(coords)
{ lat: 52.4, lon: 13.4 }
{ lat: 52.5, lon: 13.4 }
{ lat: 52.6, lon: 13.4 }
{ lat: 52.4, lon: 13.5 }
{ lat: 52.5, lon: 13.5 }
{ lat: 52.6, lon: 13.5 }
{ lat: 52.4, lon: 13.6 }
{ lat: 52.5, lon: 13.6 }
{ lat: 52.6, lon: 13.6 }

bbox must an array with 4 numbers, minLat, minLon, maxLat, maxLon. step must be a number.

You can pipe the async iterable into a Node.js stream.Writable using stream.pipeline():

const {pipeline} = require('stream')

pipeline(
	it,
	someWritableStream,
	(err) => {
		if (err) {
			console.error(err)
			process.exit(1)
		}
	}
)

callbag interface

const pipe = require('callbag-pipe')
const coords = require('bbox-stream/callbag')
const forEach = require('callbag-for-each')

pipe(
	coords([52.4, 13.4, 52.6, 13.6], .1),
	forEach(console.log)
)

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.

Keywords

FAQs

Package last updated on 06 Feb 2023

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