Created
August 14, 2016 23:14
-
-
Save davidtheclark/30b76d1cb8349175109b99547c7d1a4a to your computer and use it in GitHub Desktop.
antimeridian spanners
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
var VectorTile = require('vector-tile').VectorTile; | |
var Protobuf = require('pbf'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var data = fs.readFileSync(path.join(__dirname, './pbfs/river.vector.pbf')); | |
var tile = new VectorTile(new Protobuf(data)); | |
var layer = tile.layers['russian-river']; | |
var features = []; | |
for (var i = 0; i < layer.length; i++) { | |
features.push(layer.feature(i).toGeoJSON(0, 15, 6)); | |
} | |
var collection = { | |
type: 'FeatureCollection', | |
features: features, | |
}; | |
console.log(JSON.stringify(collection, null, 2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment