Gathering detailed insights and metrics for osm-p2p-geojson
Gathering detailed insights and metrics for osm-p2p-geojson
Gathering detailed insights and metrics for osm-p2p-geojson
Gathering detailed insights and metrics for osm-p2p-geojson
npm install osm-p2p-geojson
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
2 Stars
122 Commits
1 Forks
4 Watchers
6 Branches
9 Contributors
Updated on Sep 20, 2019
Latest Version
4.0.7
Package Id
osm-p2p-geojson@4.0.7
Unpacked Size
51.58 kB
Size
10.95 kB
File Count
15
NPM Version
6.10.2
Node Version
8.11.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
18
Transform OSM documents in a kappa-osm database to GeoJSON
npm install osm-p2p-geojson
1var core = require('kappa-core') 2var osmdb = require('kappa-osm') 3var ram = require('random-access-memory') 4var memdb = require('memdb') 5var osmGeoJson = require('osm-p2p-geojson') 6 7var osm = osmdb({ 8 core: core, 9 index: memdb(), 10 storage: function (name, cb) { cb(null, ram()) } 11}) 12 13osm.create({ 14 type: 'node', 15 lat: 1, 16 lon: -1, 17 tags: { 18 foo: 'bar' 19 } 20}, function (err) { 21 queryStreaming() 22 queryCallback() 23}) 24 25function queryStreaming () { 26 var q = osm.queryStream([[-Infinity, Infinity], [-Infinity, Infinity]]) 27 var geo = osmGeoJson(osm) 28 29 q.pipe(geo) 30 31 geo.on('data', console.log) 32} 33 34function queryCallback () { 35 osm.query([[-Infinity, Infinity], [-Infinity, Infinity]], function (err, docs) { 36 osmGeoJson(osm, { docs: docs }, function (err, geojson) { 37 console.log(geojson) 38 }) 39 }) 40}
1var osmGeoJson = require('osm-p2p-geojson')
Create an importer for importing GeoJSON objects into the given osm-p2p database. Can track progress through listening to the 'import' event. This event gives you the index of the most recently imported data and how many documents will be imported in total. If you try to import twice with the same importer, the callback will be called with an error.
If you want to import twice, create another importer.
1var importer = osmGeoJson.importer(osm) 2importer.on('import', function (index, total) { 3 console.log('import', index, total) 4}) 5importer.importFeatureCollection(geojson, onDone)
Creates a TransformStream that will take as input a stream of osm-p2p documents
and outputs a stream of GeoJSON. If you prefer a callback rather than a stream
for reading output, you can pass callback(err, geojson)
.
osm
- a kappa-osm
docs
- a list of OSM documents. If not provided here, they must be written
to the returned stream
.options.metadata
- Array of metadata properties to include as GeoJSON properties. Defaults to ['id', 'version', 'timestamp']
options.objectMode
- when true
will return a stream of GeoJSON feature objects instead of stringified JSON. Default false
. You can also use osmGeoJson.obj()
options.map
- a function that maps a Feature
to another Feature
. Defaults to the no-op function mapFn (feature) { return feature }
options.polygonFeatures
- either a list of tag keys and values that are polygons (for schema see https://github.com/tyrasd/osm-polygon-features/blob/master/schema.json) or a function that will be called with two arguments: coordinates
(from the GeoJSON geometry) and tags
(a hash of tag key-value pairs) and should return true
for polygons.N.B.: If options.objectMode
is enabled and no callback
is provided, the
resultant object stream will emit GeoJSON Feature
objects. This is not valid
GeoJSON as-is: the recipient of the stream will need to either wrap these
Feature
s into a FeatureCollection
or otherwise further transform them.
N.B.: Only "interesting" elements are exported. An interesting element is defined as an element that is both a) not malformed, and b) has a populated "tags" object set on it.
PRs accepted.
Small note: If editing the Readme, please conform to the standard-readme specification.
MIT © Gregor MacLennan
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/27 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More