index.js
function getFuzzyTimezoneFromTile(tile) {
  if (tile[2] === z) {
    var key = tile.join('/');
    if (key in tiles) return tiles[key];
    else throw new Error('tile not found');

  } else if (tile[2] > z) {
    // higher zoom level (9, 10, 11, ...)
    key = _getParent(tile).join('/');
    if (key in tiles) return tiles[key];
    else throw new Error('tile not found');

  } else {
    // lower zoom level (..., 5, 6, 7)
    var children = _getChildren(tile);
    var votes = [];  // list of timezone abbrevations
    var abbrs = {};  // abbrevation to full name lookup table
    children.forEach(function(child) {
      key = child.join('/');
      if (key in tiles) {
        var tz = tiles[key];   // timezone name

        // Need to use timezone abbreviation becuase e.g. America/Los_Angeles
        // and America/Vancouver are the same. Use a time to determine the
        // abbreviation, in case two similar tz have slightly different
        // daylight savings schedule.
        var abbr = moment.tz(Date.now(), tz)._z.abbrs[0];
        votes.push(abbr);
        abbrs[abbr] = tz;
      }
    });

    if (votes.length > 1) return abbrs[ss.mode(votes)];
    else throw new Error('tile not found');
  }
}
function getFuzzyTimezoneFromTile(tile) {
  if (tile[2] === z) {
    var key = tile.join('/');
    if (key in tiles) return tiles[key];
    else throw new Error('tile not found');

  } else if (tile[2] > z) {
    // higher zoom level (9, 10, 11, ...)
    key = _getParent(tile).join('/');
    if (key in tiles) return tiles[key];
    else throw new Error('tile not found');

  } else {
    // lower zoom level (..., 5, 6, 7)
    var children = _getChildren(tile);
    var votes = [];  // list of timezone abbrevations
    var abbrs = {};  // abbrevation to full name lookup table
    children.forEach(function(child) {
      key = child.join('/');
      if (key in tiles) {
        var tz = tiles[key];   // timezone name

        // Need to use timezone abbreviation becuase e.g. America/Los_Angeles
        // and America/Vancouver are the same. Use a time to determine the
        // abbreviation, in case two similar tz have slightly different
        // daylight savings schedule.
        var abbr = moment.tz(Date.now(), tz)._z.abbrs[0];
        votes.push(abbr);
        abbrs[abbr] = tz;
      }
    });

    if (votes.length > 1) return abbrs[ss.mode(votes)];
    else throw new Error('tile not found');
  }
}
function getFuzzyTimezoneFromTile ( tile ) { if ( tile [ 2 ] === z ) { var key = tile . join ( '/' ) ; if ( key in tiles ) return tiles [ key ] ; else throw new Error ( 'tile not found' ) ; } else if ( tile [ 2 ] > z ) { // higher zoom level (9, 10, 11, ...) key = _getParent ( tile ) . join ( '/' ) ; if ( key in tiles ) return tiles [ key ] ; else throw new Error ( 'tile not found' ) ; } else { // lower zoom level (..., 5, 6, 7) var children = _getChildren ( tile ) ; var votes = [ ] ; // list of timezone abbrevations var abbrs = { } ; // abbrevation to full name lookup table children . forEach ( function ( child ) { key = child . join ( '/' ) ; if ( key in tiles ) { var tz = tiles [ key ] ; // timezone name // Need to use timezone abbreviation becuase e.g. America/Los_Angeles // and America/Vancouver are the same. Use a time to determine the // abbreviation, in case two similar tz have slightly different // daylight savings schedule. var abbr = moment . tz ( Date . now ( ) , tz ) . _z . abbrs [ 0 ] ; votes . push ( abbr ) ; abbrs [ abbr ] = tz ; } } ) ; if ( votes . length > 1 ) return abbrs [ ss . mode ( votes ) ] ; else throw new Error ( 'tile not found' ) ; } }
Retrieves the timezone of the tile of interest at z8-level accuracy.
@param  {Array}  tile   [x, y, z] coordinate of a tile
@return {String}        timezone for the tile
Retrieves the timezone of the tile of interest at z8 - level accuracy .