examples/popups/app.js
function addPoints(sourceName, n_points = 10) {
  for (let i = 0; i < n_points; i++) {
    // the feature is a normal GeoJSON feature definition
    store.dispatch(mapActions.addFeatures(sourceName, [{
      type: 'Feature',
      properties: {
        id: `point${i}`,
        title: 'Random Point',
      },
      geometry: {
        type: 'Point',
        // this generates a point somewhere on the planet, unbounded.
        coordinates: [(Math.random() * 360) - 180, (Math.random() * 180) - 90],
      },
    }]));
  }
}
function addPoints(sourceName, n_points = 10) {
  for (let i = 0; i < n_points; i++) {
    // the feature is a normal GeoJSON feature definition
    store.dispatch(mapActions.addFeatures(sourceName, [{
      type: 'Feature',
      properties: {
        id: `point${i}`,
        title: 'Random Point',
      },
      geometry: {
        type: 'Point',
        // this generates a point somewhere on the planet, unbounded.
        coordinates: [(Math.random() * 360) - 180, (Math.random() * 180) - 90],
      },
    }]));
  }
}
Handy all around function for adding a random
set of points to the map.
@param {string} sourceName The name of the source to add to.
@param {number} n_points Number of random points to add.