You are here

private function GeoJSON::objToGeometryCollection in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/lib/adapters/GeoJSON.class.php \GeoJSON::objToGeometryCollection()
1 call to GeoJSON::objToGeometryCollection()
GeoJSON::objToGeom in geoPHP/lib/adapters/GeoJSON.class.php

File

geoPHP/lib/adapters/GeoJSON.class.php, line 106

Class

GeoJSON
GeoJSON class : a geojson reader/writer.

Code

private function objToGeometryCollection($obj) {
  $geoms = array();
  if (empty($obj->geometries)) {
    throw new Exception('Invalid GeoJSON: GeometryCollection with no component geometries');
  }
  foreach ($obj->geometries as $comp_object) {
    $geoms[] = $this
      ->objToGeom($comp_object);
  }
  return new GeometryCollection($geoms);
}