diff options
author | booo <borgers@mi.fu-berlin.de> | 2011-02-13 12:00:08 +0100 |
---|---|---|
committer | booo <borgers@mi.fu-berlin.de> | 2011-02-13 12:00:08 +0100 |
commit | 380016154f5049460f5221fc1eec655d3e868622 (patch) | |
tree | 0155214202125a96634b5f1e025e57570d01e0a7 /src/nodejs | |
parent | b5d337df5ff322ff09ed4083777473f2bffa3e1d (diff) | |
download | osm-xapi-380016154f5049460f5221fc1eec655d3e868622.tar.gz osm-xapi-380016154f5049460f5221fc1eec655d3e868622.tar.xz osm-xapi-380016154f5049460f5221fc1eec655d3e868622.zip |
handle tags with new node-postgres module; xml escaping still broken
Diffstat (limited to 'src/nodejs')
-rw-r--r-- | src/nodejs/main.js | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/nodejs/main.js b/src/nodejs/main.js index 96d1043..faa7e12 100644 --- a/src/nodejs/main.js +++ b/src/nodejs/main.js @@ -43,21 +43,18 @@ function rowToNode(row){ 'lat' : row.lat, 'lon' : row.lon }; - - if(row.tags != '{}') { - node.tags = []; - temp = row.tags.replace("{","").replace("}","").split(","); - for(var x=0;x<temp.length;x=x+2){ + node.tags = [] + if(row.tags.length != 0) { + for(var i=0;i<row.tags.length;i=i+2) { node.tags.push({ - 'key' : temp[x], - 'value' : temp[x+1] - }); + 'key' : row.tags[i], + 'value' : row.tags[i+1] + }) } } return node; } -//FIXME: parsing of ways is meesed up function rowToWay(row){ var way = { 'id' : row.id, @@ -65,17 +62,16 @@ function rowToWay(row){ 'version' : row.version, 'changeset' : row.changeset_id }; - if(row.tags != '{}') { - way.tags = []; - // FIXME: something doesnt work at all - temp = row.tags.replace("{","").replace("}","").split(","); - for(var x=0;x<temp.length;x=x+2){ + way.tags = [] + if(row.tags.length != 0) { + for(var i=0;i<row.tags.length;i=i+2) { way.tags.push({ - 'k' : temp[x], - 'v' : temp[x+1] - }); + 'key' : row.tags[i], + 'value' : row.tags[i+1] + }) } } + //TODO return nodes of way return way; } |