/** * Serialize geometries into a WKT string. * * @param Geometry $geometry * * @return string The WKT string representation of the input geometries */ public function write(Geometry $geometry) { // If geos is installed, then we take a shortcut and let it write the WKT if (geoPHP::geosInstalled()) { $writer = new GEOSWKTWriter(); return $writer->write($geometry->geos()); } $type = strtolower($geometry->geometryType()); if (is_null($data = $this->extract($geometry))) { return null; } return strtoupper($type) . ' (' . $data . ')'; }
/** * Serialize geometries into a WKT string. * * @param Geometry $geometry * * @return string The WKT string representation of the input geometries */ public function write(Geometry $geometry) { // If geos is installed, then we take a shortcut and let it write the WKT if (geoPHP::geosInstalled()) { $writer = new GEOSWKTWriter(); $writer->setTrim(TRUE); return $writer->write($geometry->geos()); } if ($geometry->isEmpty()) { return strtoupper($geometry->geometryType()) . ' EMPTY'; } else { if ($data = $this->extractData($geometry)) { return strtoupper($geometry->geometryType()) . ' (' . $data . ')'; } } }
public function project(Geometry $point, $normalized = NULL) { if ($this->geos()) { return $this->geos()->project($point->geos(), $normalized); } }