Skip to content

Instantly share code, notes, and snippets.

@kkaefer
Created August 22, 2011 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkaefer/8162aa04a4ba20e26ecf to your computer and use it in GitHub Desktop.
Save kkaefer/8162aa04a4ba20e26ecf to your computer and use it in GitHub Desktop.
#!/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