leaflet-geojson-stream

0.0.0 • Public • Published

leaflet-geojson-stream

Stream GeoJSON features into a Leaflet layer.

api

lgs.ajax(url: string, layer: L.geoJson instance)

Request all features from a given url with hyperquest and add them incrementally to layer. Returns a stream of feature objects that also emits end on completion.

lgs.layerPipe(layer: L.geoJson instance)

Given a L.geoJson instance, return a writable stream that accepts GeoJSON Feature objects.

example

var leafletStream = require('leaflet-geojson-stream'),
    map = L.map('map').setView([0, 0], 2),
    gj = L.geoJson().addTo(map);
 
leafletStream.ajax('/points.geojson', gj)
    .on('end', function() {
        alert('all done!');
    });

To run the prepackaged example:

npm install
cd example
node server.js

And open http://localhost:3000/

How

A simple abstraction on top of geojson-stream, which is in turn just a bit of sugar on JSONStream.

Dependents (5)

Package Sidebar

Install

npm i leaflet-geojson-stream

Weekly Downloads

15

Version

0.0.0

License

BSD-2-Clause

Last publish

Collaborators

  • tmcw