Skip to content

Instantly share code, notes, and snippets.

@hallahan
Created April 24, 2014 18:33
Show Gist options
  • Save hallahan/11264750 to your computer and use it in GitHub Desktop.
Save hallahan/11264750 to your computer and use it in GitHub Desktop.
Attempt at basic usage of vector-tile-js
/**
* Created by Nicholas Hallahan <nhallahan@spatialdev.com>
* on 4/23/14.
*/
var fs = require('fs');
var VectorTile = require('vector-tile');
var testPbf = fs.readFileSync('./node_modules/vector-tile/test/fixtures/14-8801-5371.vector.pbf');
var testVct = new VectorTile(testPbf);
// 2 layers, gadm0 USA / Canada, gadm1 w/ complete North & South Dakota
var pbf4_3_5 = fs.readFileSync('./4_3_5.vector.pbf');
var vct4_3_5 = new VectorTile(pbf4_3_5);
// one layer, border of districts in kenya
var ryanPbf = fs.readFileSync('./ryan_kenya.vector.pbf');
var ryanVct = new VectorTile(ryanPbf);
// just 1 layer, New England States
var pbf1 = fs.readFileSync('./4-tiles/7-37-46.vector.pbf');
var pbf2 = fs.readFileSync('./4-tiles/7-37-47.vector.pbf');
var pbf3 = fs.readFileSync('./4-tiles/7-38-46.vector.pbf');
var pbf4 = fs.readFileSync('./4-tiles/7-38-47.vector.pbf');
var t1 = new VectorTile(pbf1);
var t2 = new VectorTile(pbf2);
var t3 = new VectorTile(pbf3);
var t4 = new VectorTile(pbf4);
https://www.dropbox.com/s/gp7k0m5vnzx0db8/two_layers.mbtiles
https://www.dropbox.com/s/7qoy46sjmd8jjqd/4_3_5.vector.pbf
https://www.dropbox.com/s/zwuuyrh02n2v6ov/ryan_kenya.vector.pbf
// 4-tiles
https://www.dropbox.com/sh/hm04p531e4p0egx/5kpf0B3Xfa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment