vt-dumper

0.0.1 • Public • Published

vt-dumper

Just a function to grab a single vector tile. You provide:

  • TileJSON that indicates where to get the tile from
  • Tile coordinates to grab, as an array of [z, x, y]

Example usage

var vtDump = require('vt-dumper');
var fs = require('fs');
var tilejson = JSON.parse(fs.readFileSync('/path/to/tilejson.json'));
var coords = [ 1, 0, 1 ];
 
// Calling the `vtDump` function loads your data source
vtDump(tilejson, function(err, getTile) {
    // Any errors would be related to loading your TileJSON
    if (err) throw err;
 
    // Callback gives you a function that you can use to make tile requests
    getTile(coords, function(err, geojson, vtile, size) {
        // If there were errors loading your tile...
        if (err) throw err;
 
        // Otherwise you have 
        // - `vtile`: the mapnik vector tile, 
        // - `size`: its compressed size, and 
        // - `geojson`: a GeoJSON representation of the data as an array
        //     of FeatureCollections, one for each layer in the tile.
        doSomethingWith(geojson);
    });
});

Readme

Keywords

none

Package Sidebar

Install

npm i vt-dumper

Weekly Downloads

0

Version

0.0.1

License

BSD

Last publish

Collaborators

  • rclark