1. Dražen Odobašić
  2. kartolog

Commits

Dražen Odobašić  committed fcbedc0

updated mapreduce script for mongodb 1.8

  • Participants
  • Parent commits 5e8440c
  • Branches default

Comments (0)

Files changed (3)

File README

View file
  • Ignore whitespace
   * Python (2.6.5)
   * Tornado (1.1)
   * PyMongo (1.9)
-  * MongoDB (1.6)
+  * MongoDB (1.8)
   * Mapnik (0.7.1)
   * PIL (1.1.7)
 

File mapreduce.js

  • Ignore whitespace
-m = function () { 
-//    for (layer in this.layers){
-	emit({
-	    'layer':this.layers,
-	    'image format':this.img_format
-	},{
-	    'count':1,
-	    'diskusage':this.tilesize
-	})
-  //  }
-}
-
-r = function (k,vals){ 
-    var sum=0;
-    var tsize=0;
-    for (var i in vals){
-	sum+=vals[i].count;
-	tsize+=vals[i].diskusage;
-    } 
-    return {'count':sum,'diskusage':tsize};
-}
-
-fin = function(key, val) {
-    val.diskusage = val.diskusage / 1024 / 1024;
-    return val;
-},
-
-
-//res = db.tiles.mapReduce(m,r,{query:{'layers':'proracun'}});
-res = db.tiles.mapReduce(m,r,{finalize:fin});
-//res.find()

File mr_layerstats.js

View file
  • Ignore whitespace
+m = function () { 
+//    for (layer in this.layers){
+	emit({
+	    'layer':this.layers,
+	    'image format':this.img_format
+	},{
+	    'count':1,
+	    'diskusage':this.tilesize
+	})
+  //  }
+}
+
+r = function (k,vals){ 
+    var sum=0;
+    var tsize=0;
+    for (var i in vals){
+	sum+=vals[i].count;
+	tsize+=vals[i].diskusage;
+    } 
+    return {'count':sum,'diskusage':tsize};
+}
+
+fin = function(key, val) {
+    val.diskusage = val.diskusage / 1024 / 1024;
+    return val;
+},
+
+
+//res = db.tiles.mapReduce(m,r,{query:{'layers':'proracun'}});
+res = db.tiles.mapReduce(m,r,{finalize:fin,out:{inline:1}});
+//res.find()