Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/osmcha/osm-changeset-xml-parser
JavaScript module to parse OSM changeset metadata in XML format
https://github.com/osmcha/osm-changeset-xml-parser
Last synced: about 2 months ago
JSON representation
JavaScript module to parse OSM changeset metadata in XML format
- Host: GitHub
- URL: https://github.com/osmcha/osm-changeset-xml-parser
- Owner: OSMCha
- License: isc
- Created: 2024-09-09T22:55:30.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-09T23:13:11.000Z (4 months ago)
- Last Synced: 2024-09-10T03:34:33.872Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# osm-changeset-xml-parser
Parse OpenStreetMap Changeset metadata XML documents into plain JavaScript objects.
**Note: you may not need this package.** The OSM API is capable of returning this metadata in JSON natively if you append `.json` to the endpoint URL, like this:
```
curl -i 'https://api.openstreetmap.org/api/0.6/changeset/133061984.json'
```## Installation
```
npm install @osmcha/osm-changeset-xml-parser
```## Usage
```js
import parseChangesetXML from "@osmcha/osm-changeset-xml-parser";
let changeset = await parseChangesetXML(xmlString);
```## Example input & output
Input:
```xml
```
Output:
```json
{
"version": "0.6",
"generator": "openstreetmap-cgimap 2.0.1 (1849 spike-07.openstreetmap.org)",
"copyright": "OpenStreetMap and contributors",
"attribution": "http://www.openstreetmap.org/copyright",
"license": "http://opendatacommons.org/licenses/odbl/1-0/",
"changeset": {
"id": 155530622,
"created_at": "2024-08-20T21:36:16Z",
"closed_at": "2024-08-20T21:36:17Z",
"open": false,
"user": "jake-low",
"uid": 8794039,
"min_lat": 47.6647943,
"min_lon": -121.2881568,
"max_lat": 47.6647943,
"max_lon": -121.2881568,
"comments_count": 0,
"changes_count": 1,
"tags": {
"changesets_count": "1992",
"comment": "Skykomish, WA: add name, operator, and website to Necklace Valley Trailhead",
"created_by": "iD 2.29.0",
"host": "https://www.openstreetmap.org/edit",
"imagery_used": "Bing Maps Aerial",
"locale": "en-US"
}
}
}
```