{"id":13554165,"url":"https://github.com/osmlab/osm-request","last_synced_at":"2025-05-12T14:47:38.225Z","repository":{"id":29660136,"uuid":"122318987","full_name":"osmlab/osm-request","owner":"osmlab","description":"JS library for OpenStreetMap API communication","archived":false,"fork":false,"pushed_at":"2024-08-31T06:49:44.000Z","size":1241,"stargazers_count":30,"open_issues_count":8,"forks_count":7,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2025-04-15T13:06:36.481Z","etag":null,"topics":[],"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/osmlab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-21T09:57:25.000Z","updated_at":"2025-02-21T14:23:10.000Z","dependencies_parsed_at":"2024-11-04T02:31:15.709Z","dependency_job_id":"cf9f315d-a475-4cf6-ac11-26ffdf5aeb48","html_url":"https://github.com/osmlab/osm-request","commit_stats":{"total_commits":104,"total_committers":6,"mean_commits":"17.333333333333332","dds":0.5576923076923077,"last_synced_commit":"a2707edc204c59c01c3a069e906e52b75987b18b"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmlab%2Fosm-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmlab%2Fosm-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmlab%2Fosm-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmlab%2Fosm-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osmlab","download_url":"https://codeload.github.com/osmlab/osm-request/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253758128,"owners_count":21959533,"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:40.964Z","updated_at":"2025-05-12T14:47:38.205Z","avatar_url":"https://github.com/osmlab.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![GitHub Tag](https://img.shields.io/github/v/tag/osmlab/osm-request)](https://github.com/osmlab/osm-request/tags)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/osmlab/osm-request/build-tests-coverage.yml)](https://github.com/osmlab/osm-request/actions/workflows/build-tests-coverage.yml)\n[![Coverage Status](https://coveralls.io/repos/github/osmlab/osm-request/badge.svg?branch=develop)](https://coveralls.io/github/osmlab/osm-request?branch=develop)\n\n# OSM Request\n\nRequest the [OSM API](https://wiki.openstreetmap.org/wiki/API) (v0.6) from Javascript, with promises :)\n\n## Installation\n\n```sh\nnpm install osm-request\n```\n\n## Usage\n\nThe full documentation of osm-request API is detailed in [the API documentation](API.md).\n\nOSM Request use the same configurations properties as [osm-auth 2.5.0](https://github.com/osmlab/osm-auth). So you can define your options in a constante conf variable and use it both for osm-request and osm-auth.\n\n### Register your OAuth 2 application\n\n1. Open https://www.openstreetmap.org/oauth2/applications\n2. Click on `Register new application`\n3. Choose a `name` for your app, example: `demo-app`\n4. Choose a `Redirect URI`\n    - For development, you can choose https://localhost and some port, it should be https.\n    - For production, you can choose the url of your app, it should be https.\n5. Choose the permission you need for your app.\n    - read_prefs is the minimum\n    - write_api is needed if your app can edit data\n6. Consider choosing more permissions if needed\n    - Read user preferences (read_prefs)\n    - Modify user preferences (write_prefs)\n    - Create diary entries, comments and make friends (write_diary)\n    - Modify the map (write_api)\n    - Read private GPS traces (read_gpx)\n    - Upload GPS traces (write_gpx)\n    - Modify notes (write_notes)\n    - Redact map data (write_redactions)\n    - Sign-in using OpenStreetMap (openid)\n7. Click on `Register`\n8. Make sure to copy the `Client ID`\n9. The `Client Secret` is not needed, no need to copy it, also make sure not to disclose it\n\nNote that OAuth 2.0 do no need the `Client Secret` to work. So it is safe to publish the `Client ID` of your app online. For example, you can create a browser/JavaScript app containing your `Client ID` and publish it online (on GitHub pages, etc).\n\n### Example with single page and auto login form\n\nThe bellow example only show how to use osm-request. But to work, it needs first that you connect the user of your app to OSM throught osm-auth. To connect your user, please read osm-auth [readme](https://github.com/osmlab/osm-auth)\n\n```javascript\nimport OsmRequest from 'osm-request';\n\nconst conf = {\n  scope: 'read_prefs write_api', // To customize\n  client_id: \"YOUR_CLIENT_ID\", // To customize\n  redirect_uri: '',\n  url: 'https://www.openstreetmap.org',\n  apiUrl: 'https://api.openstreetmap.org',\n  auto: true,\n  singlepage: true\n};\n\nconst osmRequest = new OsmRequest(conf);\n\nasync function start() {\n  let element = await osmRequest.fetchElement('node/3683625932');\n  element = osmRequest.setTag(element, 'key', 'value');\n  element = osmRequest.setTags(element, {\n    key1: 'value1',\n    key2: 'value2',\n    key3: 'value3',\n  });\n  element = osmRequest.removeTag(element, 'key2');\n  element = osmRequest.setTimestampToNow(element);\n  element = osmRequest.setCoordinates(element, 1.234, 0.456);\n\n  const changesetId = await osmRequest.createChangeset('Created by me', 'My changeset comment');\n  const isChangesetStillOpen = await osmRequest.isChangesetStillOpen(changesetId);\n  const newElementVersion = await osmRequest.sendElement(element, changesetId);\n  element = osmRequest.setVersion(element, newElementVersion);\n}\n\nstart();\n```\n\nFor the OSM dev instance, use that apiUrl: https://api06.dev.openstreetmap.org\n\n## Contribute\n\nTo start contribute on this project, you can retrieve code using the following commands:\n\n```sh\ngit clone git@github.com:osmlab/osm-request.git\ncd osm-request\nnpm install\nnpm run watch\n```\n\nThis project uses a specific work flow for branches:\n\n* `master` branch is dedicated to releases, managed by repo maintainers\n* `develop` branch is for currently developed version, managed by repo maintainers\n* `feature/...` branches are for all developers, working on a particular feature\n\nPull requests are welcome, as the project is fully open-source. If you want to work on new features, please create a branch named `feature/yourFeatureName`. When work is done, open a pull request to merge your branch on `develop` branch. The code will be reviewed by one or several developers before being merged, in order to keep a good code quality.\n\n### eslint version 8.X\n\nFor now eslint stays in version 8.X. We need to wait until babel, babel plugins and eslint plugins (that we use), are compatibles with version 9.X of eslint.\n\n## Make a release\n\n```sh\ngit checkout develop\ngit pull origin develop\nnpm version patch -m \"release: %s\"\nnpm publish\ngit checkout master\ngit pull origin master\ngit merge develop\ngit push origin master\n```\n\n  `npm version` tests the code, builds it and updates the doc. Then it upgrades the package version number according to the used keyword (patch, minor or major) and commits the modifications in Git (with a proper version tag). Finally, it pushes it to repository with the tag.\n\n## Apps or libs using osm-request\n\n- [Balluchon](https://gitlab.limos.fr/iia_braikeh/balluchon)\n- [BANCO](https://github.com/PanierAvide/EditeurCommercesOSMFR)\n- [Bike Ottawa Interactive Maps](https://github.com/BikeOttawa/maps.bikeottawa.ca-frontend)\n- [Busy-Hours](https://github.com/Jungle-Bus/Busy-Hours)\n- [Ça reste ouvert](https://github.com/caresteouvert/caresteouvert_backend)\n- [OSM Mobile tag it](https://github.com/toutpt/osm-mobile-tagit)\n- [osm-edit-bundle](https://www.npmjs.com/package/osm-edit-bundle)\n- [OsmInEdit](https://framagit.org/PanierAvide/osminedit)\n- [Parking Mapper](https://github.com/Binnette/parking-mapper)\n- [Pic4Review](https://framagit.org/Pic4Carto/Pic4Review)\n- [POIEditor](https://github.com/francois2metz/poieditor)\n- [ProjetDuMois](https://github.com/vdct/ProjetDuMois)\n- [tumulus](https://github.com/superrache/tumulus)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosmlab%2Fosm-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosmlab%2Fosm-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosmlab%2Fosm-request/lists"}