transform(4326); } $this->point = array("x" => $pt->x, "y" => $pt->y, "z" => $pt->z); } /** * @return string a string representation of the object, currently geoJSON. */ public function __toString() { return $this->toGeoJSON(); } /** * @return string a geoJSON string representation of the object. */ public function toGeoJSON () { if ($this->point !== null) { if ($this->point["z"]) { return "{\"type\": \"Point\", \"coordinates\": [".$this->point["x"].",".$this->point["y"].",".$this->point["z"]."]}"; } else { return "{\"type\": \"Point\", \"coordinates\": [".$this->point["x"].",".$this->point["y"]."]}"; } } $e = new mb_exception("KMLPoint: toGeoJSON: this point is null."); return ""; } /** * @return array a point as associative array, coordinates as ["x"] and ["y"] and ["z"] */ public function getPoint () { return $this->point; } /** * @var float[] an associative array, with "x", and "y" and "z" being float values. */ private $point; } ?>