osm-stream

0.0.13 • Public • Published

OSM Stream

Uses the Overpass API for Augmented Diffs, loads data with CORS and exposes a stream.

using

Without browserify: copy osmstream.js. That works as an osmStream global and with UMD.

With browserify npm install osm-stream

api

s.once(function(err, data) { }, [bbox])

Get one batch of changes right now.

s.run(function(err, stream), duration, [dir], [bbox])

duration is how long between runs: default 1 minute

dir is direction: either 1, the default, or -1 for rewind.

s.runFn(function(err, stream), duration, [dir], [bbox])

Same as .run but instead of returning a stream that pipes objects, calls the callback once per object.

duration is how long between runs: default 1 minute

dir is direction: either 1, the default, or -1 for rewind.

example

var osmStream = require('osm-stream');
 
// re-request every 60s
osmStream
    .run(function(err, stream) {
        stream.on('data', function(d) {
            console.log(d);
        });
    });
 
// re-request every 60s
// callback-style interface
osmStream
    .runFn(function(err, data) {
        // ...
    });
 
// one-time request
osmStream
    .once(function(err, d) {
        console.log(d);
    });

The stream returned uses through, so you can end it and that will also stop the run cycle.

See Also

As Seen

Readme

Keywords

Package Sidebar

Install

npm i osm-stream

Weekly Downloads

11

Version

0.0.13

License

Public Domain

Last publish

Collaborators

  • geohacker
  • sbma44
  • planemad
  • mtirwin
  • mcwhittemore
  • isiyu
  • freenerd
  • apendleton
  • alulsh
  • amyleew
  • iandees
  • mapbox-admin
  • sgillies
  • lbud
  • bsudekum
  • dnomadb
  • ian29
  • nickidlugash
  • samanbb
  • ajashton
  • lxbarth
  • ianshward
  • mourner
  • tristen
  • ingalls
  • ansis
  • jfirebaugh
  • miccolis
  • gretacb
  • morganherlocker
  • rclark
  • willwhite
  • springmeyer
  • kkaefer
  • yhahn