geoPointsClustered method

List<Map<String, double>> geoPointsClustered({
  1. int clusterCount = 5,
  2. int pointsPerCluster = 20,
  3. double clusterRadius = 5,
})

Generates clustered geographic points.

Implementation

List<Map<String, double>> geoPointsClustered({
  int clusterCount = 5,
  int pointsPerCluster = 20,
  double clusterRadius = 5,
}) {
  final points = <Map<String, double>>[];

  for (int c = 0; c < clusterCount; c++) {
    final centerLat = _random.uniform(-60, 60);
    final centerLon = _random.uniform(-150, 150);

    for (int p = 0; p < pointsPerCluster; p++) {
      points.add({
        'latitude': centerLat + _random.normal(0, clusterRadius),
        'longitude': centerLon + _random.normal(0, clusterRadius),
        'cluster': c.toDouble(),
        'value': _random.uniform(0, 100),
      });
    }
  }

  return points;
}