You are here

protected function WktGenerator::buildPolygon in Geofield 8

Builds a polygon format string from an array of point components.

Parameters

array $points: Array containing the polygon components coordinates.

Return value

string The structured polygon coordinates.

3 calls to WktGenerator::buildPolygon()
WktGenerator::buildMultipolygon in src/WktGenerator.php
Builds a multipolygon coordinates.
WktGenerator::generateMultipolygon in src/WktGenerator.php
Generates a multipolygon coordinates.
WktGenerator::wktBuildPolygon in src/WktGenerator.php
Returns a WKT format polygon feature given an array of points.

File

src/WktGenerator.php, line 270

Class

WktGenerator
Helper class that generates WKT format geometries.

Namespace

Drupal\geofield

Code

protected function buildPolygon(array $points) {
  $components = [];
  foreach ($points as $point) {
    $components[] = $this
      ->buildPoint($point);
  }
  return '(' . implode(", ", $components) . ')';
}