Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env node
- /**
- * Convert the given omnivore-compatible vector source into an mbtiles
- * file of vector tiles.
- */
- var path = require('path')
- var multi = require('multimeter')(process)
- var tilelive = require('tilelive')
- require('tilelive-omnivore').registerProtocols(tilelive)
- require('mbtiles').registerProtocols(tilelive)
- if(process.argv.length < 4) {
- console.log('Usage: ', process.argv[0], process.argv[1], ' source.shp dest.mbtiles')
- process.exit()
- }
- var srcuri = 'omnivore://' + path.resolve(process.cwd(), process.argv[2])
- var dsturi = 'mbtiles://' + path.resolve(process.cwd(), process.argv[3])
- multi.drop({width: 40}, function (bar) {
- tilelive.copy(srcuri, dsturi, {
- type: 'scanline',
- minzoom: 0,
- maxzoom: 13,
- progress: function(stats, p) {
- bar.percent(p.percentage)
- }
- }, function (err) {
- if (err) throw err;
- console.log('\n\nFinished')
- process.exit()
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement