You are here

private function WKT::parseGeometryCollection in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/lib/adapters/WKT.class.php \WKT::parseGeometryCollection()

File

geoPHP/lib/adapters/WKT.class.php, line 152

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);
}