You are here

protected function WktGenerator::generateMultipoint in Geofield 8

Generates a multipoint coordinates.

Return value

string The structured multipoint coordinates.

1 call to WktGenerator::generateMultipoint()
WktGenerator::wktGenerateMultipoint in src/WktGenerator.php
Returns a WKT format multipoint feature.

File

src/WktGenerator.php, line 132

Class

WktGenerator
Helper class that generates WKT format geometries.

Namespace

Drupal\geofield

Code

protected function generateMultipoint() {
  $num = $this
    ->ddGenerate(1, 5, TRUE);
  $start = $this
    ->randomPoint();
  $points[] = $this
    ->buildPoint($start);
  for ($i = 0; $i < $num; $i += 1) {
    $diff = $this
      ->randomPoint();
    $start[0] += $diff[0] / 100;
    $start[1] += $diff[1] / 100;
    $points[] = $this
      ->buildPoint($start);
  }
  return $this
    ->buildMultiCoordinates($points);
}