index.js
function count (extent, minZoom, maxZoom, quick) {
  quick = quick || 1000
  let count = 0

  // Quick count
  if (quick !== -1) {
    for (const [columns, rows] of levels(extent, minZoom, maxZoom)) {
      count += rows.length * columns.length
    }
    if (count > quick) { return count }
  }

  // Accurate count
  count = 0
  const grid = single(extent, minZoom, maxZoom)
  while (true) {
    const {done} = grid.next()
    if (done) { break }
    count++
  }
  return count
}
function count (extent, minZoom, maxZoom, quick) {
  quick = quick || 1000
  let count = 0

  // Quick count
  if (quick !== -1) {
    for (const [columns, rows] of levels(extent, minZoom, maxZoom)) {
      count += rows.length * columns.length
    }
    if (count > quick) { return count }
  }

  // Accurate count
  count = 0
  const grid = single(extent, minZoom, maxZoom)
  while (true) {
    const {done} = grid.next()
    if (done) { break }
    count++
  }
  return count
}
function count ( extent , minZoom , maxZoom , quick ) { quick = quick || 1000 let count = 0 // Quick count if ( quick !== - 1 ) { for ( const [ columns , rows ] of levels ( extent , minZoom , maxZoom ) ) { count += rows . length * columns . length } if ( count > quick ) { return count } } // Accurate count count = 0 const grid = single ( extent , minZoom , maxZoom ) while ( true ) { const { done } = grid . next ( ) if ( done ) { break } count ++ } return count }
Counts the total amount of tiles from a given BBox

@param {BBox|BBox[]|GeoJSON} extent BBox [west, south, east, north] order or GeoJSON Polygon
@param {number} minZoom Minimum Zoom
@param {number} maxZoom Maximum Zoom
@param {number} [quick=1000] Enable quick count if greater than number
@returns {number} Total tiles from BBox
@example
const count = slippyGrid.count([-180.0, -90.0, 180, 90], 3, 8)
//=count 563136
Counts the total amount of tiles from a given BBox