-
-
Save mapsam/34b496529bbe9c09f3ee77b20670515a to your computer and use it in GitHub Desktop.
report node-mapnik validty/simplicity
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
#!/usr/bin/env node | |
"use strict"; | |
var exists = require('fs').existsSync || require('path').existsSync; | |
var fs = require('fs'); | |
var usage = 'usage:'; | |
usage += '\n mapnik-info.js <tile.mvt> z x y'; | |
var tile = process.argv[2]; | |
if (!tile) { | |
console.log(usage); | |
process.exit(1); | |
} | |
if (!exists(tile)) { | |
console.log(tile + ' does not exist'); | |
process.exit(1); | |
} | |
var z = process.argv[3]; | |
var x = process.argv[4]; | |
var y = process.argv[5]; | |
var mapnik = require('../'); | |
mapnik.register_default_input_plugins(); | |
var vt = new mapnik.VectorTile(parseInt(z), parseInt(x), parseInt(y)); | |
var buffer = fs.readFileSync(tile); | |
vt.addData(buffer); | |
console.log('VALIDITY'); | |
var val = vt.reportGeometryValiditySync(); | |
val.forEach(function(v) { | |
console.log(v.message); | |
console.log('\n'); | |
}) | |
console.log('SIMPLICITY'); | |
console.log(vt.reportGeometrySimplicitySync()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment