Skip to content

Instantly share code, notes, and snippets.

@bnchdrff
Created March 20, 2020 15:09
Show Gist options
  • Save bnchdrff/bf04a013557aa2654fcb4b64c066053f to your computer and use it in GitHub Desktop.
Save bnchdrff/bf04a013557aa2654fcb4b64c066053f to your computer and use it in GitHub Desktop.
example of comparing mvt data
const fetch = require('node-fetch');
const Protobuf = require('pbf');
const { VectorTile } = require('@mapbox/vector-tile');
const { Headers } = fetch;
async function logTile(url) {
const res = await fetch(url);
const blob = await res.arrayBuffer();
const buf = new Protobuf(blob);
const tile = new VectorTile(buf);
console.log({
url,
places: tile.layers.places
});
}
async function main() {
await logTile('https://tileserver.production.streetcred.co/osm/15/9648/12316.mvt');
await logTile('https://tileserver.production.streetcred.co/osm/17/104433/67861.mvt');
}
main().then(() => {
console.log('done');
process.exit(0);
}).catch(err => {
console.error(err);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment