osm-p2p-server
Advanced tools
Comparing version 1.0.0 to 1.0.1
34
index.js
@@ -61,6 +61,4 @@ var routes = require('routes') | ||
h('bounds/', { | ||
minlat: q[0][0], | ||
maxlat: q[0][1], | ||
minlon: q[1][0], | ||
maxlon: q[1][1] | ||
minlat: q[0][0], maxlat: q[0][1], | ||
minlon: q[1][0], maxlon: q[1][1] | ||
}) | ||
@@ -72,8 +70,25 @@ ]) | ||
function write (row, enc, next) { | ||
var t = row.type, tags = row.tags || {} | ||
var children = [] | ||
;(row.refs || []).forEach(function (ref) { | ||
children.push(h('nd/', { ref: ref })) | ||
}) | ||
delete row.refs | ||
Object.keys(row.members || []).forEach(function (ref) { | ||
children.push(h('member/', { | ||
type: 'relation', | ||
ref: ref, | ||
role: '' | ||
})) | ||
}) | ||
delete row.members | ||
Object.keys(row.tags || {}).forEach(function (key) { | ||
children.push(h('tag', { k: key, v: row.tags[key] })) | ||
}) | ||
delete row.tags | ||
var tag = row.type | ||
delete row.type | ||
delete row.tags | ||
next(null, h(t, row, Object.keys(tags).map(function (key) { | ||
return h('tag', { k: key, v: tags[key] }) | ||
}))) | ||
next(null, h(tag, row, children)) | ||
} | ||
@@ -108,2 +123,3 @@ function end (next) { | ||
var id = ch.id | ||
ch.timestamp = new Date().toISOString() | ||
console.log('CREATE', ch) | ||
@@ -110,0 +126,0 @@ delete ch.id |
{ | ||
"name": "osm-p2p-server", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "serve osm http endpoints over a p2p db", | ||
@@ -18,3 +18,3 @@ "main": "index.js", | ||
"level": "^1.4.0", | ||
"osm-p2p-db": "^2.0.0" | ||
"osm-p2p-db": "^2.1.0" | ||
}, | ||
@@ -21,0 +21,0 @@ "dependencies": { |
9208
192