tilelive-utfgrid

0.2.0 • Public • Published

BuildStatus

tilelive-utfgrid

A tilelive provider that allows UTFGrid-generating sources (i.e. those with a getGrid() method) to be treated as though they generate data tiles rather than treating grid output as "special".

This registers the utfgrid+ prefix and currently supports the mbtiles: (using node-mbtiles) and tmstyle: (using tilelive-tmstyle) protocols (although it will work with any source that implements getGrid()).

Usage

To fetch grids from an MBTiles archive using getTile:

"use strict";
 
var MBTiles = require("mbtiles"),
    tilelive = require("tilelive");
 
var UTFGrid = require("tilelive-utfgrid")(tilelive);
 
MBTiles.registerProtocols(tilelive);
UTFGrid.registerProtocols(tilelive);
 
tilelive.load("utfgrid+mbtiles:///path/to/archive.mbtiles", function(err, source) {
  if (err) {
    console.error(err.stack);
    process.exit(1);
  }
 
  return source.getTile(0, 0, 0, function(err, data, headers) {
    if (err) {
      console.error(err.stack);
      process.exit(1);
    }
 
    console.log("Headers:", headers);
    console.log("UTFGrid:", data);
  });
});

Readme

Keywords

none

Package Sidebar

Install

npm i tilelive-utfgrid

Weekly Downloads

1

Version

0.2.0

License

ISC

Last publish

Collaborators

  • mojodna