https://github.com/osmcha/osm-adiff-parser
Parse OSM augmented diffs and create JSON representation of changesets
https://github.com/osmcha/osm-adiff-parser
Last synced: 4 months ago
JSON representation
Parse OSM augmented diffs and create JSON representation of changesets
- Host: GitHub
- URL: https://github.com/osmcha/osm-adiff-parser
- Owner: OSMCha
- License: bsd-3-clause
- Created: 2024-02-07T23:23:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-31T22:08:24.000Z (about 1 year ago)
- Last Synced: 2025-09-26T09:43:42.431Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 7.26 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# osm-adiff-parser
Parses OSM [augmented diff](https://wiki.openstreetmap.org/wiki/Overpass_API/Augmented_Diffs) XML and returns a plain JS object representing the diff.
## Installation
```
npm install @osmcha/osm-adiff-parser
```
## Usage
```js
import parser from 'osm-adiff-parser';
let adiff = await parser(augmentedDiffXmlString);
```
## Example input & output
Input (an augmented diff of a simple changeset which added a couple of tags to an existing node)
```xml
The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.
```
Output
```json
{
"actions": [
{
"type": "modify",
"old": {
"type": "node",
"id": 2523603738,
"version": 2,
"user": "TheRomanP",
"uid": 3844185,
"timestamp": "2024-06-05T13:51:12Z",
"changeset": 152289357,
"lon": -121.2881568,
"lat": 47.6647943,
"tags": {
"highway": "trailhead"
}
},
"new": {
"type": "node",
"id": 2523603738,
"version": 3,
"timestamp": "2024-08-20T21:36:16Z",
"uid": 8794039,
"user": "jake-low",
"changeset": 155530622,
"lat": 47.6647943,
"lon": -121.2881568,
"tags": {
"highway": "trailhead",
"name": "Necklace Valley Trailhead",
"operator": "US Forest Service",
"website": "https://www.fs.usda.gov/recarea/mbs/recarea/?recid=80228"
}
}
}
],
"note": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
}
```
## Command line interface
This package also provides a CLI tool which reads augmented diff XML from stdin and writes the parsed representation to stdout as JSON.
```
$ osm-adiff-parser --help
osm-adiff-parser v3.1.0
Convert OSM augmented diff XML to a JSON representation
Usage:
osm-adiff-parser [options] < input.xml > output.json
Options:
-h, --help Show this help message
-v, --version Show version number
```
## History
This package is a fork of [mapbox/osm-adiff-parser](https://github.com/mapbox/osm-adiff-parser/) which is no longer maintained. Version 2.0.0 of `@osmcha/osm-adiff-parser` contains breaking API changes compared to version 1.1.0 of `osm-adiff-parser`. See the [CHANGELOG] for more details.
[CHANGELOG]: ./CHANGELOG.md