private function WKT::parseGeometryCollection in geoPHP 8
Same name and namespace in other branches
- 7 geoPHP/lib/adapters/WKT.class.php \WKT::parseGeometryCollection()
File
- geoPHP/
lib/ adapters/ WKT.class.php, line 148
Class
- WKT
- WKT (Well Known Text) Adapter
Code
private function parseGeometryCollection($data_string) {
$data_string = $this
->trimParens($data_string);
// If it's marked as empty, then return an empty geom-collection
if ($data_string == 'EMPTY') {
return new GeometryCollection();
}
$geometries = array();
$matches = array();
$str = preg_replace('/,\\s*([A-Za-z])/', '|$1', $data_string);
$components = explode('|', trim($str));
foreach ($components as $component) {
$geometries[] = $this
->read($component);
}
return new GeometryCollection($geometries);
}