You are here

static function geoPHP::geosToGeometry in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/geoPHP.inc \geoPHP::geosToGeometry()
12 calls to geoPHP::geosToGeometry()
Collection::centroid in geoPHP/lib/geometry/Collection.class.php
Geometry::buffer in geoPHP/lib/geometry/Geometry.class.php
Geometry::convexHull in geoPHP/lib/geometry/Geometry.class.php
Geometry::difference in geoPHP/lib/geometry/Geometry.class.php
Geometry::envelope in geoPHP/lib/geometry/Geometry.class.php

... See full list

File

geoPHP/geoPHP.inc, line 135

Class

geoPHP

Code

static function geosToGeometry($geos) {
  if (!geoPHP::geosInstalled()) {
    return NULL;
  }
  $wkb_writer = new GEOSWKBWriter();
  $wkb = $wkb_writer
    ->writeHEX($geos);
  $geometry = geoPHP::load($wkb, 'wkb', TRUE);
  if ($geometry) {
    $geometry
      ->setGeos($geos);
    return $geometry;
  }
}