pointArray, array("x" => $x, "y" => $y)); } public function toGml2 () { $str = "srs\">" . ""; $ptArray = array(); foreach ($this->pointArray as $point) { $ptArray[] = $point["x"] . "," . $point["y"]; } $str .= implode(" ", $ptArray); $str .= ""; $str .= ""; return $str; } public function toGml3 () { $str = "srs\">" . ""; $ptArray = array(); foreach ($this->pointArray as $point) { $ptArray[] = "" . $point["x"] . " " . $point["y"] . ""; } $str .= implode("", $ptArray); $str .= ""; $str .= ""; return $str; } public function toGeoJSON () { $numberOfPoints = count($this->pointArray); $str = ""; if ($numberOfPoints > 0) { $str .= "{\"type\": \"LineString\", \"coordinates\":["; for ($i=0; $i < $numberOfPoints; $i++) { if ($i > 0) { $str .= ","; } $str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]"; } $str .= "]}"; } else { $e = new mb_exception("GMLLine: toGeoJSON: this point is null."); } return $str; } } ?>