geojson-stream

WebJar for geojson-stream

License

License

BSD 2-Clause
Categories

Categories

Geo Business Logic Libraries Geospatial JSON Data
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

geojson-stream
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

geojson-stream
WebJar for geojson-stream
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/node-geojson/geojson-stream

Download geojson-stream

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/geojson-stream/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>geojson-stream</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/geojson-stream/
implementation 'org.webjars.npm:geojson-stream:0.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/geojson-stream/
implementation ("org.webjars.npm:geojson-stream:0.1.0")
'org.webjars.npm:geojson-stream:jar:0.1.0'
<dependency org="org.webjars.npm" name="geojson-stream" rev="0.1.0">
  <artifact name="geojson-stream" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='geojson-stream', version='0.1.0')
)
libraryDependencies += "org.webjars.npm" % "geojson-stream" % "0.1.0"
[org.webjars.npm/geojson-stream "0.1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : JSONStream jar [1.0.0,2)
org.webjars.npm : through jar [2.3.4,3)

Project Modules

There are no modules declared in this project.

geojson-stream

Greenkeeper badge build status

Stream features into and out of GeoJSON objects and Feature Collections. Little more than JSONStream with pre-filled settings.

usage

npm install --save geojson-stream

api

geojsonStream.stringify()

Returns a transform stream that accepts GeoJSON Feature objects and emits a stringified FeatureCollection.

geojsonStream.parse(mapFunc)

Returns a transform stream that accepts a GeoJSON FeatureCollection as a stream and emits Feature objects.

mapFunc(feature, index) is an optional function which takes a Feature, and its zero-based index in the FeatureCollection and returns either a Feature, or null/undefined if the feature should be omitted from output.

example

const geojsonStream = require('geojson-stream');
const fs = require('fs');
const out = fs.createWriteStream('buildings-with-id.geojson');
fs
    .createReadStream(`buildings.geojson`)
    .pipe(geojsonStream.parse((building, index) => {
        if (building.geometry.coordinates === null) {
            return null;
        }
        building.id = index;
        return building;
    }))
    .pipe(geojsonStream.stringify())
    .pipe(out);
org.webjars.npm

Versions

Version
0.1.0