{"id":15853399,"url":"https://github.com/simonepri/osm-geojson","last_synced_at":"2025-09-24T06:32:36.726Z","repository":{"id":49985097,"uuid":"110899284","full_name":"simonepri/osm-geojson","owner":"simonepri","description":"🔰 Get GeoJSON of a OpenStreetMap's relation from the API.","archived":false,"fork":false,"pushed_at":"2021-06-07T04:14:51.000Z","size":71,"stargazers_count":49,"open_issues_count":5,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-11T11:45:31.691Z","etag":null,"topics":["api","geojson","maps","openstreetmap"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonepri.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-15T23:36:21.000Z","updated_at":"2024-03-26T01:58:56.000Z","dependencies_parsed_at":"2022-08-03T15:45:10.724Z","dependency_job_id":null,"html_url":"https://github.com/simonepri/osm-geojson","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Fosm-geojson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Fosm-geojson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Fosm-geojson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Fosm-geojson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonepri","download_url":"https://codeload.github.com/simonepri/osm-geojson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234053227,"owners_count":18772090,"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":["api","geojson","maps","openstreetmap"],"created_at":"2024-10-05T19:04:49.380Z","updated_at":"2025-09-24T06:32:31.433Z","avatar_url":"https://github.com/simonepri.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/simonepri/osm-geojson\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/osm-geojson/raw/master/media/osm-geojson.png\" alt=\"osm-geojson\" width=\"340\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003c!-- Version - npm --\u003e\n  \u003ca href=\"https://www.npmjs.com/package/osm-geojson\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/osm-geojson.svg\" alt=\"Latest version on npm\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Downloads - npm --\u003e\n  \u003ca href=\"https://npm-stat.com/charts.html?package=osm-geojson\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dt/osm-geojson.svg\" alt=\"Downloads on npm\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- License - MIT --\u003e\n  \u003ca href=\"https://github.com/simonepri/osm-geojson/tree/master/license\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/simonepri/osm-geojson.svg\" alt=\"Project license\" /\u003e\n  \u003c/a\u003e\n\n  \u003cbr/\u003e\n\n  \u003c!-- Lint --\u003e\n  \u003ca href=\"https://github.com/simonepri/osm-geojson/actions?query=workflow:lint+branch:master\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/osm-geojson/workflows/lint/badge.svg?branch=master\" alt=\"Lint status\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test - macOS --\u003e\n  \u003ca href=\"https://github.com/simonepri/osm-geojson/actions?query=workflow:test-macos+branch:master\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/osm-geojson/workflows/test-macos/badge.svg?branch=master\" alt=\"Test macOS status\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test - Ubuntu --\u003e\n  \u003ca href=\"https://github.com/simonepri/osm-geojson/actions?query=workflow:test-ubuntu+branch:master\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/osm-geojson/workflows/test-ubuntu/badge.svg?branch=master\" alt=\"Test Ubuntu status\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test - Windows --\u003e\n  \u003ca href=\"https://github.com/simonepri/osm-geojson/actions?query=workflow:test-windows+branch:master\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/osm-geojson/workflows/test-windows/badge.svg?branch=master\" alt=\"Test Windows status\" /\u003e\n  \u003c/a\u003e\n\n  \u003cbr/\u003e\n\n  \u003c!-- Coverage - Codecov --\u003e\n  \u003ca href=\"https://codecov.io/gh/simonepri/osm-geojson\"\u003e\n    \u003cimg src=\"https://img.shields.io/codecov/c/github/simonepri/osm-geojson/master.svg\" alt=\"Codecov Coverage report\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- DM - Snyk --\u003e\n  \u003ca href=\"https://snyk.io/test/github/simonepri/osm-geojson?targetFile=package.json\"\u003e\n    \u003cimg src=\"https://snyk.io/test/github/simonepri/osm-geojson/badge.svg?targetFile=package.json\" alt=\"Known Vulnerabilities\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- DM - David --\u003e\n  \u003ca href=\"https://david-dm.org/simonepri/osm-geojson\"\u003e\n    \u003cimg src=\"https://david-dm.org/simonepri/osm-geojson/status.svg\" alt=\"Dependency Status\" /\u003e\n  \u003c/a\u003e\n\n  \u003cbr/\u003e\n\n  \u003c!-- Code Style - XO-Prettier --\u003e\n  \u003ca href=\"https://github.com/xojs/xo\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/code_style-XO+Prettier-5ed9c7.svg\" alt=\"XO Code Style used\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test Runner - AVA --\u003e\n  \u003ca href=\"https://github.com/avajs/ava\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/test_runner-AVA-fb3170.svg\" alt=\"AVA Test Runner used\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test Coverage - Istanbul --\u003e\n  \u003ca href=\"https://github.com/istanbuljs/nyc\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/test_coverage-NYC-fec606.svg\" alt=\"Istanbul Test Coverage used\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Init - ni --\u003e\n  \u003ca href=\"https://github.com/simonepri/ni\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/initialized_with-ni-e74c3c.svg\" alt=\"NI Scaffolding System used\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Release - np --\u003e\n  \u003ca href=\"https://github.com/sindresorhus/np\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/released_with-np-6c8784.svg\" alt=\"NP Release System used\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  🔰 Get GeoJSON of a OpenStreetMap's relation from the API.\n  \u003cbr/\u003e\n\n  \u003csub\u003e\n    Coded with ❤️ by \u003ca href=\"#authors\"\u003eSimone Primarosa\u003c/a\u003e.\n  \u003c/sub\u003e\n\u003c/p\u003e\n\n## Install\n\n```\n$ npm install --save osm-geojson\n```\n\n## Usage\n\n```js\nconst osmGeoJson = require('osm-geojson');\n\nosmGeoJson.get('365331'); // Italy\n// =\u003e { type: 'GeometryCollection', geometries: [ { type: 'MultiPolygon', coordinates: [Array] } ] }\n\nosmGeoJson.getAll({'ITA': '365331', 'USA': '148838'}); // Italy\n// =\u003e {\n// 'ITA': { type: 'GeometryCollection', geometries: [ { type: 'MultiPolygon', coordinates: [Array] } ] },\n// 'USA': { type: 'GeometryCollection', geometries: [ { type: 'MultiPolygon', coordinates: [Array] } ] }\n// }\n```\n\n## CLI\n\n### Install\nTo use the CLI just install the package globally.\n```\n$ npm install --g osm-geojson\n```\nOr run it with `npx` if you are not planning to use it more than once.\n```\n$ npx osm-geojson\n```\n\n### Help\n```bash\nUsage\n  $ osm-geojson \u003cosmId\u003e\n  $ osm-geojson -l [\u003cosmId\u003e:\u003cfilename\u003e]+\nOptions\n  -l  --list [\u003cosmId\u003e:\u003cfilename\u003e]+   To fetch a list of osmIds. Each relation\n                                     will be saved in a file called\n                                     filename.geojson\n  -p --pretty                        To beautify the outputted JSON.\nExamples\n  $ osm-geojson 365331\n  $ osm-geojson -p 365331\n  $ osm-geojson -p 365331 \u003e filename.geojson\n  $ osm-geojson -l 365331:ita 148838:usa\n```\n\n## API\n\n\u003ca name=\"get\"\u003e\u003c/a\u003e\n\n### get(osmid) ⇒ \u003ccode\u003ePromise.\u0026lt;object\u0026gt;\u003c/code\u003e\nReturns the GeoJSON of a particular OSM relation id.\n\n**Returns**: \u003ccode\u003ePromise.\u0026lt;object\u0026gt;\u003c/code\u003e - A promise that contains the GeoJSON of the given\nrelation.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| osmid | \u003ccode\u003estring\u003c/code\u003e | Relation id from which extract the GeoJSON. |\n\n\u003ca name=\"getAll\"\u003e\u003c/a\u003e\n\n### getAll(map) ⇒ \u003ccode\u003ePromise.\u0026lt;object\u0026gt;\u003c/code\u003e\nReturns a map of GeoJSON of multiple OSM relation ids.\n\n**Returns**: \u003ccode\u003ePromise.\u0026lt;object\u0026gt;\u003c/code\u003e - A promise that contains the map with the same keys\nof the map provided but with the GeoJSON of the given relation id as value.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| map | \u003ccode\u003eobject\u003c/code\u003e | Map from a name to a relation id from which extract the GeoJSON. |\n\n## Authors\n\n- **Simone Primarosa** - *Github* ([@simonepri][github:simonepri]) • *Twitter* ([@simoneprimarosa][twitter:simoneprimarosa])\n\nSee also the list of [contributors][contributors] who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [license][license] file for details.\n\n\n\u003c!-- Links --\u003e\n[start]: https://github.com/simonepri/osm-geojson#start-of-content\n[contributors]: https://github.com/simonepri/osm-geojson/contributors\n\n[license]: https://github.com/simonepri/osm-geojson/tree/master/license\n\n[github:simonepri]: https://github.com/simonepri\n[twitter:simoneprimarosa]: http://twitter.com/intent/user?screen_name=simoneprimarosa\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonepri%2Fosm-geojson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonepri%2Fosm-geojson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonepri%2Fosm-geojson/lists"}