-
-
Save kkaefer/8162aa04a4ba20e26ecf 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
#!/usr/bin/env node | |
var fs = require('fs'); | |
var path = require('path'); | |
var child_process = require('child_process'); | |
var usage = 'usage: bench.js <stylesheet> <image>'; | |
var stylesheet = process.ARGV[2]; | |
if (!stylesheet) { | |
console.log(usage); | |
process.exit(1); | |
} | |
var image = process.ARGV[3]; | |
if (!image) { | |
console.log(usage); | |
process.exit(1); | |
} | |
var start = Date.now(); | |
var mapnik = require('..'); | |
var map = new mapnik.Map(1200, 800); | |
map.loadSync(stylesheet); | |
map.zoomAll(); | |
var data = map.renderSync('png8'); | |
console.warn('Took %dms', Date.now() - start); | |
fs.writeFileSync(image, data); | |
child_process.exec('open ' + image); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment