function _wkt_generate in Geofield 7
Helper to generate a random WKT string
Try to keeps values sane, no shape is more than 100km across
1 call to _wkt_generate()
File
- ./
geofield.devel_generate.inc, line 72 - Create random data to populate geofields.
Code
function _wkt_generate() {
$types = array(
'point',
'linestring',
'polygon',
'multipoint',
'multilinestring',
'multipolygon',
);
// don't always generate the same type
shuffle($types);
$type = $types[0];
$func = '_wkt_generate_' . $type;
if (function_exists($func)) {
$wkt = $func();
return drupal_strtoupper($type) . ' (' . $wkt . ')';
}
return 'POINT (0 0)';
}