Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Latest commit

 

History

History
51 lines (34 loc) · 1.13 KB

File metadata and controls

51 lines (34 loc) · 1.13 KB

osm-p2p-defork

Convert forking osm-p2p documents into a linear history.

Transforms a list of osm-p2p-db documents into a sublist with a linear (non-forking) history.

Usage

var defork = require('osm-p2p-defork')

osm.query([[-90, 90], [-180, 180]], function (err, docs) {
  docs = defork(docs)
  console.log(docs)
})

outputs the results from the osm.query(), but with a linear history (no forked documents).

API

var defork = require('osm-p2p-defork')

defork(docs)

Consumes a list of OSM documents, formatted as would be returned by osm-p2p-db's query function.

Returns the same documents, but with certain documents filtered to present a linear history.

Timestamps (a timestamp field) should be present on all documents. If they aren't, sorting happens based on the document's version field. This guarantees a non-forking history, but it will not likely be semantically what you want.

Install

With npm installed, run

$ npm install osm-p2p-defork

License

ISC