Created
March 20, 2020 15:09
-
-
Save bnchdrff/bf04a013557aa2654fcb4b64c066053f to your computer and use it in GitHub Desktop.
example of comparing mvt data
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
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