Created
March 10, 2016 20:57
-
-
Save tmcw/31ec3a95c4cb9b4a37f5 to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
var tileReduce = require('../../src'); | |
var path = require('path'); | |
var numFeatures = 0; | |
// TileReduce currently | |
tileReduce({ | |
bbox: [-122.05862045288086, 36.93768132842635, -121.97296142578124, 37.00378647456494], | |
zoom: 15, | |
map: path.join(__dirname, '/count.js'), | |
sources: [{name: 'osm', mbtiles: path.join(__dirname, '../../test/fixtures/osm.mbtiles'), raw: true}] | |
}) | |
.on('reduce', function(num) { | |
numFeatures += num; | |
}) | |
.on('end', function() { | |
console.log('Features total: %d', numFeatures); | |
}); | |
// Following the format of normal reduce methods | |
tileReduce({ | |
bbox: [-122.05862045288086, 36.93768132842635, -121.97296142578124, 37.00378647456494], | |
zoom: 15, | |
map: path.join(__dirname, '/count.js'), | |
sources: [{name: 'osm', mbtiles: path.join(__dirname, '../../test/fixtures/osm.mbtiles'), raw: true}] | |
}) | |
.reduce(function(numFeatures, num) { | |
return numFeatures + num; | |
}, 0) | |
.on('end', function() { | |
console.log('Features total: %d', numFeatures); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment