public function toXmlNoWrap() { if ($this->isComplex()) { $str = ""; foreach ($this->filterArray as $filter) { $str .= $filter->toXmlNoWrap(); } $op = $this->mapOperator($this->booleanOperator); return "<" . $op["open"] . ">" . $str . "</" . $op["close"] . ">"; } else { $k = "<ogc:PropertyName>" . $this->key . "</ogc:PropertyName>"; if (in_array($this->operator, explode(",", self::SPATIAL_OPERATORS))) { $gmlFactory = new UniversalGmlFactory(); $gml = $gmlFactory->createFromGeoJson($this->value, $this->wfsConf); $v = $gml->toGml(); } else { $v = "<ogc:Literal>" . $this->value . "</ogc:Literal>"; } $op = $this->mapOperator($this->operator); return "<" . $op["open"] . ">" . $k . $v . "</" . $op["close"] . ">"; } }
/** * Shortcut for GeoJSON conversion * * @return String * @param $geoJson String */ public static function geoJsonToGml($geoJson) { $gmlFactory = new UniversalGmlFactory(); $myGmlObj = $gmlFactory->createFromGeoJson($geoJson); return $myGmlObj->toGml(); }
if (is_null($wfsConf)) { sendErrorMessage("Invalid WFS conf: " . $wfs_conf_id); } // append authorisation condition to filter $filter = checkAccessConstraint($filter, $wfs_conf_id); $admin = new administration(); $filter = administration::convertIncomingString($filter); $wfsId = $wfsConf->wfsId; $myWfsFactory = new UniversalWfsFactory(); $myWfs = $myWfsFactory->createFromDb($wfsId); $data = $myWfs->getFeature($typename, $filter, $destSrs); if ($data === null) { die('{}'); } if (defined("WFS_RESPONSE_SIZE_LIMIT") && WFS_RESPONSE_SIZE_LIMIT < strlen($data)) { die("Too many results, please restrict your search."); } // $geomColumn = WfsConf::getGeomColumnNameByConfId($wfs_conf_id); $gmlFactory = new UniversalGmlFactory(); $myGml = $gmlFactory->createFromXml($data, $wfsConf); if (!is_null($myGml)) { $geoJson = $myGml->toGeoJSON(); } else { $geoJson = "{}"; } header("Content-type:application/x-json; charset=utf-8"); echo $geoJson; } else { echo "please enter a valid command."; } }