You are here

private function GeoJSON::objToGeometryCollection in geoPHP 8

Same name and namespace in other branches
  1. 7 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 101

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