Created
August 21, 2011 17:53
-
-
Save bingomanatee/1160915 to your computer and use it in GitHub Desktop.
Updating a series of tiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* scale = 128 | |
* i_limit = c.5600 | |
* j_limit = c.11000 | |
*/ | |
for (var i = 0; i < i_limit; i += scale) | |
for (var j = 0; j < j_limit; j += scale) { | |
// if (i > i_limit) continue; | |
// if (j > j_limit) continue; | |
var heights = _chunk(image_data, i, i + scale, j, j + scale); | |
// _chunk produces a 128 x 128 set of ints (nested arrays, 128 128-value arrays | |
var query = {min_image_i: i, min_image_j: j, image: image._id}; | |
var set_heights = {"$set": {heights: heights}}; | |
mit_model.update(query, _stub, set_heights); | |
// note my model's update profile is slightly rearranged - update(filter, callback, document) | |
} | |
callback(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment