Skip to content

Instantly share code, notes, and snippets.

@davidtheclark
Created August 14, 2016 23:14
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 davidtheclark/30b76d1cb8349175109b99547c7d1a4a to your computer and use it in GitHub Desktop.
Save davidtheclark/30b76d1cb8349175109b99547c7d1a4a to your computer and use it in GitHub Desktop.
antimeridian spanners
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));
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment