[Mapbender-commits] r10044 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Feb 1 04:30:35 PST 2019
Author: armin11
Date: 2019-02-01 04:30:35 -0800 (Fri, 01 Feb 2019)
New Revision: 10044
Modified:
trunk/mapbender/http/classes/class_wfs.php
Log:
Fix for wfs getfeature requests with different wfs versions - thanx to peter.lang from saarland ;-)
Modified: trunk/mapbender/http/classes/class_wfs.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs.php 2019-01-31 16:08:12 UTC (rev 10043)
+++ trunk/mapbender/http/classes/class_wfs.php 2019-02-01 12:30:35 UTC (rev 10044)
@@ -93,12 +93,26 @@
}
protected function getFeatureGet ($featureTypeName, $filter, $maxFeatures=null) {
+ switch ($this->getVersion()) {
+ case "2.0.2":
+ $typeNameParameterName = "typenames";
+ $maxFeaturesParameterName = "COUNT";
+ break;
+ case "2.0.0":
+ $typeNameParameterName = "typenames";
+ $maxFeaturesParameterName = "COUNT";
+ break;
+ default:
+ $typeNameParameterName = "typename";
+ $maxFeaturesParameterName = "MAXFEATURES";
+ break;
+ }
$url = $this->getFeature .
$this->getConjunctionCharacter($this->getFeature) .
"service=WFS&request=getFeature&version=" .
- $this->getVersion() . "&typename=" . $featureTypeName;
+ $this->getVersion() . "&".$typeNameParameterName."typename=" . $featureTypeName;
if ($maxFeatures != null) {
- $url .= "&MAXFEATURES=".$maxFeatures;
+ $url .= "&".$maxFeaturesParameterName."=".$maxFeatures;
}
if ($filter != null) {
$url .= "&filter=" . urlencode($filter);
@@ -108,6 +122,20 @@
}
protected function getFeaturePost ($featureTypeName, $filter, $destSrs, $storedQueryId, $storedQueryParams, $maxFeatures) {
+ switch ($this->getVersion()) {
+ case "2.0.2":
+ $typeNameParameterName = "typeNames";
+ $maxFeaturesParameterName = "COUNT";
+ break;
+ case "2.0.0":
+ $typeNameParameterName = "typeNames";
+ $maxFeaturesParameterName = "COUNT";
+ break;
+ default:
+ $typeNameParameterName = "typeName";
+ $maxFeaturesParameterName = "MAXFEATURES";
+ break;
+ }
if($storedQueryId && $storedQueryId != "") {
$postData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
"<wfs:GetFeature service=\"WFS\" version=\"" . $this->getVersion() . "\" " .
@@ -164,22 +192,16 @@
$postData .= "xmlns:" . $ns . "=\"" . $url . "\" ";
}
- if($this->getVersion() == "2.0.0") {
+ if($this->getVersion() == "2.0.0" || $this->getVersion() == "2.0.2") {
//change filter to fes syntax
$filter = str_replace("<ogc", "<fes", $filter);
$filter = str_replace("/ogc", "/fes", $filter);
- $filter = str_replace("PropertyName", "ValueReference", $filter);
- $postData .= "typeNames=\"" . $featureTypeName . "\">" .
- $filter .
- "</wfs:Query>";
}
- else {
- $postData .= "typeName=\"" . $featureTypeName . "\">" .
- $filter .
- "</wfs:Query>";
- }
+ $filter = str_replace("PropertyName", "ValueReference", $filter);
+ $postData .= $typeNameParameterName."=\"" . $featureTypeName . "\">" .
+ $filter .
+ "</wfs:Query>";
}
-
$postData .= "</wfs:GetFeature>";
$e = new mb_notice("class_wfs.php: getFeaturePost: ".$postData);
if ($filter == null) {
@@ -192,7 +214,7 @@
}
} else {
if (is_int($maxFeatures)) {
- return $this->post($this->getFeature."&MAXFEATURES=".$maxFeatures, $postData); //from class_ows!
+ return $this->post($this->getFeature."&".$maxFeaturesParameterName."=".$maxFeatures, $postData); //from class_ows!
} else {
return $this->post($this->getFeature, $postData); //from class_ows!
}
More information about the Mapbender_commits
mailing list