var point = require('turf-point');

/**
 * Takes a bounding box and a cell depth and outputs points in a grid.
 *
 * @module turf/grid
 * @param {Array<number>} extent extent in [xmin, ymin, xmax, ymax] order
 * @param {Number} depth how many cells to output
 * @return {FeatureCollection} grid as FeatureCollection with {@link Point} features
 * @example
 * var grid = turf.grid([0,0,10,10], 10);
 * //=grid
 */
module.exports = function(extents, depth) {
  var xmin = extents[0];
  var ymin = extents[1];
  var xmax = extents[2];
  var ymax = extents[3];
  var interval = (xmax - xmin) / depth;
  var coords = [];
  var fc = {
    type: 'FeatureCollection',
    features: []
  };

  for (var x=0; x<=depth; x++){
    for (var y=0;y<=depth; y++){
      fc.features.push(point((x * interval) + xmin, (y * interval) + ymin));
    }
  }
  return fc;
}

var point = require('turf-point');

/**
 * Takes a bounding box and a cell depth and outputs points in a grid.
 *
 * @module turf/grid
 * @param {Array<number>} extent extent in [xmin, ymin, xmax, ymax] order
 * @param {Number} depth how many cells to output
 * @return {FeatureCollection} grid as FeatureCollection with {@link Point} features
 * @example
 * var extent = [-70.823364, -33.553984, -70.473175, -33.302986];
 * var depth = 10;
 *
 * var grid = turf.grid(extent, depth);
 *
 * //=grid
 */
module.exports = function(extents, depth) {
  var xmin = extents[0];
  var ymin = extents[1];
  var xmax = extents[2];
  var ymax = extents[3];
  var interval = (xmax - xmin) / depth;
  var coords = [];
  var fc = {
    type: 'FeatureCollection',
    features: []
  };

  for (var x=0; x<=depth; x++){
    for (var y=0;y<=depth; y++){
      fc.features.push(point((x * interval) + xmin, (y * interval) + ymin));
    }
  }
  return fc;
}

Change example from Null Island to Santiago, Chile
Change example from Null Island to Santiago, Chile
