aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/nodejs/main.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/nodejs/main.js b/src/nodejs/main.js
index 80bd051..96d1043 100644
--- a/src/nodejs/main.js
+++ b/src/nodejs/main.js
@@ -93,7 +93,7 @@ var options = [
// {
// object = node/way/relation/* ,
// bbox = { left : 1.0 , right : 1.0 , top : 1.0, bottom : 1.0 }
-// tag = { key : [ ], value [ ] }
+// tag = { key : [ ], value [ ] }
// }
@@ -101,14 +101,14 @@ function buildMainQuery(reqJso){
var id = 1;
var replacements = Array();
-
+
var selectMap = {
- 'node' : 'id,user_id,tstamp,version,changeset_id,hstore_to_array(tags) as tags, ' +
+ 'node' : 'id,user_id,tstamp,version,changeset_id,hstore_to_array(tags) as tags, ' +
'X(geom) as lat, Y(geom) as lon',
'way' : 'id,tstamp,version,changeset_id,nodes,user_id,hstore_to_array(tags) as tags ',
'relation' : '' //FIXME: plz
- }
-
+ }
+
// FIXME: help me i am not side effect free
function buildTagsQuery(map){
@@ -125,7 +125,7 @@ function buildMainQuery(reqJso){
// FIXME: help me i am not side effect free
function buildBbox(object,bbox){
-
+
var colName = {
node : 'geom',
way : 'linestring',
@@ -136,7 +136,7 @@ function buildMainQuery(reqJso){
' st_setsrid(st_makepoint($' + id++ + ', $' + id++ + '), 4326), ' +
' st_setsrid(st_makepoint($' + id++ + ', $' + id++ + '), 4326) ' +
' ), 4326) ';
-
+
for( direction in bbox ) {
replacements.push(bbox[direction]);
}
@@ -153,15 +153,15 @@ function buildMainQuery(reqJso){
}
return map;
}
-
+
query = "SELECT " + selectMap[reqJso.object] + " FROM " + reqJso.object + "s";
-
+
whereClauses = Array();
if(reqJso.bbox != undefined){
whereClauses.push(buildBbox(reqJso.object,reqJso.bbox));
}
-
+
// FIXME: rename tag to tags key to keys value to values
if(reqJso.tag != undefined){
tags = explodeTags(reqJso.tag.key,reqJso.tag.value);
@@ -278,11 +278,11 @@ function myFunction(req,res){
res.writeHead(200);
var reqObj = parser.urlToXpathObj(req.url);
-
+
var queryDict = buildMainQuery(reqObj);
-
+
var resXml = osmRes.mkXmlRes(res);
-
+
console.log(JSON.stringify(queryDict));
console.log("??????????????????????????????");
@@ -296,12 +296,12 @@ function myFunction(req,res){
});
query.on('end', function() {
- console.log(" EEEND ");
+ console.log(" EEEND ");
res.atEnd();
});
query.on('row', function(row) {
- //console.log(JSON.stringify(row));
+ //console.log(JSON.stringify(row));
if(reqObj.object == "node") {
var pojo = rowToNode(row);
res.putNode(pojo);