{"id":13554546,"url":"https://github.com/digidem/osm-p2p-api","last_synced_at":"2025-04-03T07:31:45.302Z","repository":{"id":57316535,"uuid":"101928134","full_name":"digidem/osm-p2p-api","owner":"digidem","description":"Functions for implementing the OSM API using osm-p2p-db.","archived":true,"fork":false,"pushed_at":"2019-01-09T22:52:45.000Z","size":10,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T08:15:51.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digidem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-30T20:57:36.000Z","updated_at":"2023-01-28T18:13:11.000Z","dependencies_parsed_at":"2022-08-25T21:11:03.829Z","dependency_job_id":null,"html_url":"https://github.com/digidem/osm-p2p-api","commit_stats":null,"previous_names":["noffle/osm-p2p-api"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digidem%2Fosm-p2p-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digidem%2Fosm-p2p-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digidem%2Fosm-p2p-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digidem%2Fosm-p2p-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digidem","download_url":"https://codeload.github.com/digidem/osm-p2p-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246956521,"owners_count":20860452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:02:50.208Z","updated_at":"2025-04-03T07:31:45.060Z","avatar_url":"https://github.com/digidem.png","language":"JavaScript","readme":"# osm-p2p-api\n\n\u003e Functions for implementing the OSM API using osm-p2p-db.\n\nThis module sits between [`osm-p2p-db`](https://github.com/digidem/osm-p2p-db)\nand [`osm-p2p-server`](https://github.com/digidem/osm-p2p-server). It provides\nthe logic that turns the data from an `osm-p2p-db` into what the\n`osm-p2p-server` needs in order to satisfy the [OSM\nAPI](https://wiki.openstreetmap.org/wiki/API_v0.6).\n\nWe (Digital Democracy) are also using it for things like GeoJSON exports in\n[Mapeo](https://github.com/digidem/mapeo-desktop).\n\n## Status\n\n**Work in Progress**. API functions from `osm-p2p-server` will be moved over\nhere incrementally as they are needed. Semver will be respected throughout the\nmove.\n\n## Usage\n\n```js\nvar osmApi = require('osm-p2p-api')\nvar osmP2p = require('osm-p2p-mem')\n\nvar osm = osmP2p()\nvar api = osmApi(osm)\n\nvar node = {\n  type: 'node',\n  lat: 14,\n  lon: -1\n}\n\nosm.create(node, function () {\n  var bbox = [-180, -85, 180, 85]\n  var stream = api.getMap(bbox, function (err, res) {\n    console.log(res)\n  })\n})\n```\n\noutputs\n\n```\n[ { type: 'node',\n    lat: 14,\n    lon: -1,\n    id: '14932367278207151409',\n    version: '6b8042a175ba486961d3d11277c6a6e9c0f882da3036dcd1e68e96e3acc45a95' } ]\n```\n\n## API\n\n```js\nvar osmApi = require('osm-p2p-api')\n```\n\n### var api = osmApi(osm)\n\nConstructs a new API object over the `osm-p2p-db` instance `osm`.\n\n### var stream = api.getMap(bbox[, opts][, cb])\n\nGet all OSM documents in the bounding box `bbox`, which is of the form\n\n```js\nvar bbox = [minLon, minLat, maxLon, maxLat]\n```\n\n`opts`, if provided, accepts the following properties:\n\n- `opts.forks` (Boolean): whether to include forks of documents. Defaults to\n  `false`.\n\nThe callback `cb` is also optional. If provided, results will be buffered and\nreturned via `cb`. If no callback is given, the function returns a Readable\nstream `stream`.\n\n\n## Install\n\nWith [npm](https://npmjs.org/) installed, run\n\n```\n$ npm install osm-p2p-api\n```\n\n## Acknowledgments\n\nThis module was born from a great idea by @gmaclennan!\n\n## License\n\nISC\n\n","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigidem%2Fosm-p2p-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigidem%2Fosm-p2p-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigidem%2Fosm-p2p-api/lists"}