Ejemplo n.º 1
0
Archivo: WKT.php Proyecto: kitbs/geoPHP
 /**
  * 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 . ')';
         }
     }
 }
Ejemplo n.º 2
0
 public function project(Geometry $point, $normalized = NULL)
 {
     if ($this->geos()) {
         return $this->geos()->project($point->geos(), $normalized);
     }
 }