Generate OSM XML from a stream of OSM JSON objects
npm install obj2osm


> Generate OSM XML from a stream of objects matching OSM JSON
- Install
- Example
- API
- Contribute
- License
```
npm install obj2osm
` js
var toxml = require('../')
var from2Array = require('from2-array')
var input = require('../test/fixture.json')
var bounds = {
minlat: 38.89958342598271,
maxlat: 38.90385833966776,
minlon: -77.02514648437499,
maxlon: -77.01965332031249
}
from2Array.obj(input)
.pipe(toxml({bounds: bounds}))
.pipe(process.stdout)
`
output:
``
$ node osm.js
` js`
var toxml = require('obj2osm')
Where:
* opts.root - Root XML element (default: osm, set to null to output XML with no root)opts.generator
* - Generator attribute for the root element (default: obj2osm)opts.bounds
* - Optional bounds to include at start of XML, either {minlat: or [[minLat, maxLat], [minLon, maxLon]]
Returns a transform object stream that expects a stream of objects matching OSM JSON format as input and produces [osm xml][1] output or [osmChange XML][2] output if input objects have an action property set to one of: create|modify|delete.
Node object format:
* node.type - 'node'node.id
* - id stringnode.version
* - version stringnode.lat
* - latitude in degreesnode.lon
* - longitude in degreesnode.tags
* - Object of tag key-value pairs: {tagKey: 'tagValue', amenity: 'cafe'}
Way object format:
* way.type - 'way'way.id
* - id stringway.version
* - version stringway.nodes
* - array of node IDsway.tags
* - Object of tag key-value pairs
Relation object format:
* relation.type - relation.typerelation.id
* - id stringrelation.version
* - version stringrelation.members
* - array of member objects: {type: 'node|way|relation', ref: 'id', role: 'role'}relation.tags` - Object of tag key-value pairs
*
[1]: http://wiki.openstreetmap.org/wiki/API_v0.6#XML_Format
[2]: http://wiki.openstreetmap.org/wiki/OsmChange
PRs welcome. Please follow JS Standard Style.
BSD