You are here

function _wkt_generate_polygon in Geofield 7

1 call to _wkt_generate_polygon()
_wkt_generate_multipolygon in ./geofield.devel_generate.inc

File

./geofield.devel_generate.inc, line 145
Create random data to populate geofields.

Code

function _wkt_generate_polygon($start = FALSE, $segments = FALSE) {
  $start = $start ? $start : _random_point();
  $segments = $segments ? $segments : _dd_generate(2, 4, TRUE);
  $poly = _wkt_generate_linestring($start, $segments);

  // close the polygon
  return '(' . $poly . ' , ' . $start[0] . ' ' . $start[1] . ')';
}