[Mapbender-commits] r10186 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Jul 24 05:53:33 PDT 2019
Author: armin11
Date: 2019-07-24 05:53:33 -0700 (Wed, 24 Jul 2019)
New Revision: 10186
Modified:
trunk/mapbender/http/classes/class_wfs.php
Log:
Force wfs version for paging to be 2.0.0 - this is an ugly workaround!
Modified: trunk/mapbender/http/classes/class_wfs.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs.php 2019-07-24 12:37:47 UTC (rev 10185)
+++ trunk/mapbender/http/classes/class_wfs.php 2019-07-24 12:53:33 UTC (rev 10186)
@@ -235,7 +235,7 @@
// return $this->getFeatureGet($featureTypeName, $filter);
}
- public function getFeaturePaging ($featureTypeName, $filter, $destSrs=null, $storedQueryId=null, $storedQueryParams=null, $maxFeatures=null, $startIndex=null) {
+ public function getFeaturePaging ($featureTypeName, $filter, $destSrs=null, $storedQueryId=null, $storedQueryParams=null, $maxFeatures=null, $startIndex=null, $version=false) {
// FOR NOW, WE ONLY DO POST REQUESTS!
// THE FILTERS ARE CONSTRUCTED ON THE CLIENT SIDE,
@@ -243,14 +243,19 @@
// WOULD BE TOO MUCH FOR NOW
//
// if (strpos($this->getFeature, "?") === false) {
- return $this->getFeaturePostPaging($featureTypeName, $filter, $destSrs, $storedQueryId, $storedQueryParams, $maxFeatures, $startIndex);
+ return $this->getFeaturePostPaging($featureTypeName, $filter, $destSrs, $storedQueryId, $storedQueryParams, $maxFeatures, $startIndex, $version);
// }
// return $this->getFeatureGet($featureTypeName, $filter);
}
- protected function getFeaturePostPaging ($featureTypeName, $filter, $destSrs, $storedQueryId, $storedQueryParams, $maxFeatures, $startIndex) {
+ protected function getFeaturePostPaging ($featureTypeName, $filter, $destSrs, $storedQueryId, $storedQueryParams, $maxFeatures, $startIndex, $version=false) {
+ if ($version == false) {
+ $version = $this->getVersion();
+ } else {
+ $e = new mb_exception("classes/class_wfs.php: wfs version forced too ".$version."!");
+ }
//maxfeatures - in newer versions count is used - for paging
- switch ($this->getVersion()) {
+ switch ($version) {
case "2.0.2":
$typeNameParameterName = "typeNames";
$maxFeaturesParameterName = "COUNT";
@@ -280,7 +285,7 @@
$postData .= "</wfs:StoredQuery>";
}
else {
- if($this->getVersion() == "2.0.0" || $this->getVersion() == "2.0.2") {
+ if($version == "2.0.0" || $version == "2.0.2") {
$postData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
"<wfs:GetFeature service=\"WFS\" version=\"" . $this->getVersion() . "\" " .
"xmlns:wfs=\"http://www.opengis.net/wfs/2.0\" ".
@@ -292,7 +297,7 @@
"startIndex=\"".$startIndex."\" count=\"".$maxFeatures."\" >";
}
//TODO: not already implemented - maybe usefull for older geoserver/mapserver implementations
- else if($this->getVersion() == "1.1.0") {
+ else if($version == "1.1.0") {
$postData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
"<wfs:GetFeature service=\"WFS\" version=\"" . $this->getVersion() . "\" " .
"xmlns:wfs=\"http://www.opengis.net/wfs\" " .
@@ -321,7 +326,7 @@
$url = $ft->getNamespace($ns);
$postData .= "xmlns:" . $ns . "=\"" . $url . "\" ";
}
- if($this->getVersion() == "2.0.0" || $this->getVersion() == "2.0.2") {
+ if($version == "2.0.0" || $version == "2.0.2") {
//change filter to fes syntax
$filter = str_replace("<ogc", "<fes", $filter);
$filter = str_replace("/ogc", "/fes", $filter);
@@ -336,7 +341,7 @@
//$e = new mb_exception("class_wfs.php: getFeaturePost url: ".$this->getFeature."&".$maxFeaturesParameterName."=".$maxFeatures."&STARTINDEX=".$startIndex);
//TODO test if post is ok! mapserver in trier don't allow it?
//test get request
- $getRequest = $this->getFeature.""."SERVICE=wfs&VERSION=".$this->getVersion()."&REQUEST=GetFeature"."&".$typeNameParameterName."=".$featureTypeName."&".$maxFeaturesParameterName."=".$maxFeatures."&STARTINDEX=".$startIndex."&".$maxFeaturesParameterName."=".$maxFeatures;
+ $getRequest = $this->getFeature.""."SERVICE=wfs&VERSION=".$version."&REQUEST=GetFeature"."&".$typeNameParameterName."=".$featureTypeName."&".$maxFeaturesParameterName."=".$maxFeatures."&STARTINDEX=".$startIndex."&".$maxFeaturesParameterName."=".$maxFeatures;
return $this->get($getRequest);
//other variants
//return $this->post($this->getFeature.$maxFeaturesParameterName."=".$maxFeatures."&STARTINDEX=".$startIndex, $postData); //from class_ows!
More information about the Mapbender_commits
mailing list