function _wkt_generate_linestring in Geofield 7
2 calls to _wkt_generate_linestring()
File
- ./
geofield.devel_generate.inc, line 117 - Create random data to populate geofields.
Code
function _wkt_generate_linestring($start = FALSE, $segments = FALSE) {
$start = $start ? $start : _random_point();
$segments = $segments ? $segments : _dd_generate(1, 5, TRUE);
$points[] = $start[0] . ' ' . $start[1];
// Points are at most 1km away from each other
for ($i = 0; $i < $segments; $i += 1) {
$diff = _random_point();
$start[0] += $diff[0] / 100;
$start[1] += $diff[1] / 100;
$points[] = $start[0] . ' ' . $start[1];
}
return implode(", ", $points);
}