Просмотр исходного кода

added featureID in GetFeature; fixed parse input params for GetFeature

Piotr Labudda 9 лет назад
Родитель
Сommit
de460d3735

+ 42 - 121
SE/se-lib/Api/WfsDataServer.php

@@ -31,62 +31,20 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 	}
 
 	public function getFeatureAction() {
-		$type = V::get('TYPENAME', '', $_REQUEST);
-		$typeEx = explode(':', $type);
-		$maxFeatures = '10000';// TODO: Set Deafult Limit
-		$maxFeatures = V::get('MAXFEATURES', $maxFeatures, $_REQUEST, 'int');
-		$maxFeatures = V::get('maxFeatures', $maxFeatures, $_REQUEST, 'int');
-		$maxFeatures = V::get('count', $maxFeatures, $_REQUEST, 'int');
-		$startIndex = V::get('startIndex', 0, $_REQUEST, 'int');// sql offset
-		$ogcFilter = '';
-		$ogcFilter = V::get('FILTER', $ogcFilter, $_REQUEST);
-		$ogcFilter = V::get('Filter', $ogcFilter, $_REQUEST);
-		$ogcFilter = urldecode($ogcFilter);
-		$sortBy = V::get('sortBy', '', $_REQUEST);
-		$propertyName = V::get('propertyName', '', $_REQUEST);
-		$propertyName = trim($propertyName);
-		$srsname = V::get('SRSNAME', '', $_REQUEST);// eg. EPSG:4326
-		if (count($typeEx) != 2) throw new HttpException("Wrong param TYPENAME", 400);
-		if (empty($ogcFilter)) {// read ogc:Filter from POST body if not defined in GET
-			$reqBody = Request::getRequestBody();
-			if (!empty($reqBody)) {
-				$ogcFilter = $this->convertOgcFilterFromRequestBody($reqBody);
-				if (empty($ogcFilter)) throw new Api_WfsException("Error Processing ogc:Filter", 501);
-			}
-		}
-		if ('hits' == V::get('resultType', '', $_REQUEST)) {// resultType=hits
-			return $this->getTotalFeatures($typeEx[0], $typeEx[1], $maxFeatures, $srsname, $ogcFilter, $sortBy, $startIndex, $propertyName, $simple = true);
+		$args = $this->parseGetFeatureArgsFromRequest();
+		if ('hits' == $args['resultType']) {
+			return $this->getTotalFeatures($args, $simple = true);
 		} else {
-			return $this->getFeatures($typeEx[0], $typeEx[1], $maxFeatures, $srsname, $ogcFilter, $sortBy, $startIndex, $propertyName, $simple = true);
+			return $this->getFeatures($args, $simple = true);
 		}
 	}
 
 	public function getFeatureAdvancedAction() {
-		$type = V::get('TYPENAME', '', $_REQUEST);
-		$typeEx = explode(':', $type);
-		$maxFeatures = '10000';// TODO: Set Deafult Limit
-		$maxFeatures = V::get('MAXFEATURES', $maxFeatures, $_REQUEST, 'int');
-		$maxFeatures = V::get('maxFeatures', $maxFeatures, $_REQUEST, 'int');
-		$maxFeatures = V::get('count', $maxFeatures, $_REQUEST, 'int');
-		$startIndex = V::get('startIndex', 0, $_REQUEST, 'int');// sql offset
-		$ogcFilter = '';
-		$ogcFilter = V::get('FILTER', $ogcFilter, $_REQUEST);
-		$ogcFilter = V::get('Filter', $ogcFilter, $_REQUEST);
-		$sortBy = V::get('sortBy', '', $_REQUEST);
-		$propertyName = V::get('propertyName', '', $_REQUEST);
-		$propertyName = trim($propertyName);
-		$srsname = V::get('SRSNAME', '', $_REQUEST);// eg. EPSG:4326
-		if (count($typeEx) != 2) throw new HttpException("Wrong param TYPENAME", 400);
-		if (empty($ogcFilter)) {// read ogc:Filter from POST body if not defined in GET
-			$reqBody = Request::getRequestBody();
-			if (!empty($reqBody)) {
-				$ogcFilter = $this->convertOgcFilterFromRequestBody($reqBody);
-			}
-		}
-		if ('hits' == V::get('resultType', '', $_REQUEST)) {// resultType=hits
-			return $this->getTotalFeatures($typeEx[0], $typeEx[1], $maxFeatures, $srsname, $ogcFilter, $sortBy, $startIndex, $propertyName, $simple = false);
+		$args = $this->parseGetFeatureArgsFromRequest();
+		if ('hits' == $args['resultType']) {
+			return $this->getTotalFeatures($args, $simple = false);
 		} else {
-			return $this->getFeatures($typeEx[0], $typeEx[1], $maxFeatures, $srsname, $ogcFilter, $sortBy, $startIndex, $propertyName, $simple = false);
+			return $this->getFeatures($args, $simple = false);
 		}
 	}
 
@@ -107,20 +65,18 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 		}
 	}
 
-	public function getTotalFeatures($nsPrefix, $type, $maxFeatures, $srsname, $ogcFilter = '', $sortBy = '', $startIndex = 0, $propertyName = '', $simple = true) {
+	public function getTotalFeatures($args, $simple = true) {
 		$DBG = (V::get('DBG_GEO', '', $_GET) > 0);// TODO: Profiler
-		$typeName = "{$nsPrefix}:{$type}";
-		if($DBG){echo "typeName($typeName})\n";}
-		$acl = $this->getAclFromTypeName($typeName);
+		if($DBG){echo "typeName({$args['xsd:type']})\n";}
+		$acl = $this->getAclFromTypeName($args['xsd:type']);
 		$fldList = $this->_getFieldListFromAcl($acl);
 
 		$baseNsUri = Api_WfsNs::getBaseWfsUri();
 		$rootWfsNs = 'p5';
 		$rootWfsNsUri = "{$baseNsUri}";
-		//$wfsNs = 'p5_default_db_' . $type;//$nsPrefix;
-		$wfsNs = $nsPrefix;//'p5_default_db';
-		$wfsNsUri = "{$baseNsUri}/" . substr($nsPrefix, 3);
-		$featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&TYPENAME={$typeName}&REQUEST=DescribeFeatureType";
+		$wfsNs = $args['typePrefix'];
+		$wfsNsUri = "{$baseNsUri}/" . substr($args['typePrefix'], 3);
+		$featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&TYPENAME={$args['xsd:type']}&REQUEST=DescribeFeatureType";
 
 		// get BBox from geom_field (only one geom fld is allowed)
 		$geomFld = null;
@@ -132,37 +88,20 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 			}
 		}
 
-		if($DBG){echo "ogcFilter(" . strlen($ogcFilter) . "): {$ogcFilter}\n";}
+		if($DBG){echo "ogcFilter(" . strlen($args['ogc:Filter']) . "): {$args['ogc:Filter']}\n";}
 		$searchParams = array();
-		$searchParams['limit'] = $maxFeatures;
-		$searchParams['limitstart'] = $startIndex;
-		if (!empty($sortBy)) {
-			$searchParams['sortBy'] = $sortBy;
+		$searchParams['limit'] = $args['limit'];
+		$searchParams['limitstart'] = $args['offset'];
+		if (!empty($args['sortBy'])) {
+			$searchParams['sortBy'] = $args['sortBy'];
 		} else {
 			$searchParams['order_by'] = $acl->getPrimaryKeyField();
 			$searchParams['order_dir'] = 'DESC';
 		}
-		if (strlen($ogcFilter) > 0) $searchParams['ogc:Filter'] = $ogcFilter;
-		if (strlen($propertyName) > 0) {
-			$propertyNamesEx = explode(',', $propertyName);
-			$onlyCols = array();
-			foreach ($propertyNamesEx as $colName) {
-				$colName = trim($colName);
-				$onlyCols[] = $colName;
-			}
-			if (!empty($onlyCols)) $searchParams['cols'] = $onlyCols;
-		}
-		{// BBOX
-			// 54.26931096743426,18.48242909824306,54.26738118403914,18.478738378639246
-			$bbox = V::get('BBOX', '', $_GET);
-			if (!empty($bbox)) {
-				if (preg_match("/^\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?$/", $bbox, $matches)) {
-					$searchParams['f_the_geom'] = "BBOX:{$bbox}";
-				} else {
-					// throw new Exception("Error Processing Request", 1);// ?
-				}
-			}
-		}
+		if (strlen($args['ogc:Filter']) > 0) $searchParams['ogc:Filter'] = $args['ogc:Filter'];
+		if (!empty($args['filterFields'])) $searchParams['cols'] = $args['filterFields'];// propertyName
+		if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];// featureID
+		if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
 		if($DBG){echo 'getItems() searchParams:';print_r($searchParams);echo "\n";}
 		$totalItems = $acl->getTotal($searchParams);
 		if($DBG){echo 'totalItems:';print_r($totalItems);echo "\n";}
@@ -186,21 +125,20 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 		exit;
 	}
 
-	public function getFeatures($nsPrefix, $type, $maxFeatures, $srsname, $ogcFilter = '', $sortBy = '', $startIndex = 0, $propertyName = '', $simple = true) {
+	public function getFeatures($args, $simple = true) {
 		$DBG = (V::get('DBG_GEO', '', $_GET) > 0);// TODO: Profiler
 		$DBG_DS = V::get('DBG_DS', 0, $_GET, 'int');
-		$typeName = "{$nsPrefix}:{$type}";
-		if($DBG){echo "typeName($typeName})\n";}
-		$acl = $this->getAclFromTypeName($typeName);
+		$type = $args['typeName'];
+		if($DBG){echo "typeName({$args['xsd:type']})\n";}
+		$acl = $this->getAclFromTypeName($args['xsd:type']);
 		$fldList = $this->_getFieldListFromAcl($acl);
 
 		$baseNsUri = Api_WfsNs::getBaseWfsUri();
 		$rootWfsNs = 'p5';
 		$rootWfsNsUri = "{$baseNsUri}";
-		//$wfsNs = 'p5_default_db_' . $type;//$nsPrefix;
-		$wfsNs = $nsPrefix;//'p5_default_db';
-		$wfsNsUri = "{$baseNsUri}/" . substr($nsPrefix, 3);
-		$featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&TYPENAME={$typeName}&REQUEST=DescribeFeatureType";
+		$wfsNs = $args['typePrefix'];
+		$wfsNsUri = "{$baseNsUri}/" . substr($args['typePrefix'], 3);
+		$featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&TYPENAME={$args['xsd:type']}&REQUEST=DescribeFeatureType";
 
 		// get BBox from geom_field (only one geom fld is allowed)
 		$geomFld = null;
@@ -212,38 +150,21 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 			}
 		}
 
-if($DBG){echo "ogcFilter(" . strlen($ogcFilter) . "): {$ogcFilter}\n";}
+		if($DBG){echo "ogcFilter(" . strlen($args['ogc:Filter']) . "): {$args['ogc:Filter']}\n";}
 		$searchParams = array();
-		$searchParams['limit'] = $maxFeatures;
-		$searchParams['limitstart'] = $startIndex;
-		if (!empty($sortBy)) {
-			$searchParams['sortBy'] = $sortBy;
+		$searchParams['limit'] = $args['limit'];
+		$searchParams['limitstart'] = $args['offset'];
+		if (!empty($args['sortBy'])) {
+			$searchParams['sortBy'] = $args['sortBy'];
 		} else {
 			$searchParams['order_by'] = $acl->getPrimaryKeyField();
 			$searchParams['order_dir'] = 'DESC';
 		}
-		if (strlen($ogcFilter) > 0) $searchParams['ogc:Filter'] = $ogcFilter;
-		if (strlen($propertyName) > 0) {
-			$propertyNamesEx = explode(',', $propertyName);
-			$onlyCols = array();
-			foreach ($propertyNamesEx as $colName) {
-				$colName = trim($colName);
-				$onlyCols[] = $colName;
-			}
-			if (!empty($onlyCols)) $searchParams['cols'] = $onlyCols;
-		}
-		{// BBOX
-			// 54.26931096743426,18.48242909824306,54.26738118403914,18.478738378639246
-			$bbox = V::get('BBOX', '', $_GET);
-			if (!empty($bbox)) {
-				if (preg_match("/^\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?$/", $bbox, $matches)) {
-					$searchParams['f_the_geom'] = "BBOX:{$bbox}";
-				} else {
-					// throw new Exception("Error Processing Request", 1);// ?
-				}
-			}
-		}
-if($DBG){echo 'getItems:';print_r($searchParams);echo "\n";}
+		if (strlen($args['ogc:Filter']) > 0) $searchParams['ogc:Filter'] = $args['ogc:Filter'];
+		if (!empty($args['filterFields'])) $searchParams['cols'] = $args['filterFields'];// PropertyName
+		if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];// featureID
+		if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
+		if($DBG){echo 'getItems:';print_r($searchParams);echo "\n";}
 		$items = $acl->getItems($searchParams);
 
 		$dom = new DOMDocument('1.0', 'utf-8');
@@ -261,7 +182,7 @@ if($DBG){echo 'getItems:';print_r($searchParams);echo "\n";}
 		//$rootNode->setAttribute('xsi:schemaLocation', 'http://www.opengis.net/wfs');
 		$rootNode->setAttribute('xsi:schemaLocation', "{$wfsNsUri} {$featureTypeUri}");
 
-if($DBG){echo '(geomFld: '.$geomFld.'):';print_r($acl->getFieldType($geomFld));echo "\n";}
+		if($DBG){echo '(geomFld: '.$geomFld.'):';print_r($acl->getFieldType($geomFld));echo "\n";}
 		if (empty($items)) {
 			$pKeyField = $acl->getPrimaryKeyField();
 			$fakeItem = new stdClass();
@@ -273,7 +194,7 @@ if($DBG){echo '(geomFld: '.$geomFld.'):';print_r($acl->getFieldType($geomFld));e
 		foreach ($items as $itemKey => $item) {
 			if (!is_array($item)) $item = (array)$item;
 
-if($DBG && !empty($geomFld)){echo 'item['.$itemKey.'] ('.$geomFld.')isEmpty('.empty($item[$geomFld]).'):';print_r($item[$geomFld]);echo "\n";}
+			if($DBG && !empty($geomFld)){echo 'item['.$itemKey.'] ('.$geomFld.')isEmpty('.empty($item[$geomFld]).'):';print_r($item[$geomFld]);echo "\n";}
 			if($DBG_DS){echo ">>> loop({$itemKey}) item: ";print_r($item);echo "\n";}
 
 			$featureMemberNode = $dom->createElementNS('http://www.opengis.net/gml', 'gml:featureMember');

+ 11 - 26
SE/se-lib/Api/WfsQgisServer.php

@@ -42,25 +42,21 @@ class Api_WfsQgisServer extends Api_WfsServerBase {
 	}
 
 	public function getFeatureAction() {
-		$type = V::get('TYPENAME', '', $_REQUEST);
-		$typeEx = explode(':', $type);
-		$maxFeatures = V::get('MAXFEATURES', '10000', $_REQUEST, 'int');// TODO: Set Deafult Limit
-		$srsname = V::get('SRSNAME', '', $_REQUEST);// eg. EPSG:4326
-		if (count($typeEx) != 2) throw new HttpException("Wrong param TYPENAME", 400);
-		return $this->getFeatures($typeEx[0], $typeEx[1], $maxFeatures, $srsname);
+		$args = $this->parseGetFeatureArgsFromRequest();
+		// TODO: if ('hits' == $args['resultType']) ...
+		return $this->getFeatures($args);
 	}
 
-	public function getFeatures($nsPrefix, $type, $maxFeatures, $srsname) {
+	public function getFeatures($args) {
 		$DBG = (V::get('DBG_GEO', '', $_GET) > 0);// TODO: Profiler
-		$typeName = "{$nsPrefix}:{$type}";
-		$acl = $this->getAclFromTypeName($typeName);
+		$type = $args['typeName'];
+		$acl = $this->getAclFromTypeName($args['xsd:type']);
 		$fldList = $this->_getFieldListFromAcl($acl);
 
 		$baseNsUri = Api_WfsNs::getBaseWfsUri();
-		//$wfsNs = 'p5_default_db_' . $type;//$nsPrefix;
-		$wfsNs = 'p5_default_db';//$nsPrefix;
-		$wfsNsUri = "{$baseNsUri}/" . substr($nsPrefix, 3);
-		$featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&TYPENAME={$typeName}&REQUEST=DescribeFeatureType";
+		$wfsNs = 'p5_default_db';//$args['typePrefix'];
+		$wfsNsUri = "{$baseNsUri}/" . substr($args['typePrefix'], 3);
+		$featureTypeUri = $this->getBaseUri() . "?SERVICE=WFS&VERSION=1.0.0&TYPENAME={$args['xsd:type']}&REQUEST=DescribeFeatureType";
 		// https://biuro.biall-net.pl/dev-pl/se-master/wfs-qgis.php/default_db/
 		// https://biuro.biall-net.pl/dev-pl/se-master/wfs-data.php/default_db/TEST_PERMS/?SERVICE=WFS&VERSION=1.0.0&TYPENAME=p5_default_db:TEST_PERMS&REQUEST=DescribeFeatureType
 
@@ -77,21 +73,10 @@ class Api_WfsQgisServer extends Api_WfsServerBase {
 		$dbGeomType = $acl->getGeomFieldType($geomFld);
 
 		$searchParams = array();
-		$searchParams['limit'] = $maxFeatures;
+		$searchParams['limit'] = $args['limit'];
 		$searchParams['order_by'] = $acl->getPrimaryKeyField();
 		$searchParams['order_dir'] = 'DESC';
-		{// BBOX
-			// 54.26931096743426,18.48242909824306,54.26738118403914,18.478738378639246
-			$bbox = V::get('BBOX', '', $_GET);
-			if (!empty($bbox)) {
-				if (preg_match("/^\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?$/", $bbox, $matches)) {
-					$searchParams['f_the_geom'] = "BBOX:{$bbox}";
-				} else {
-					// throw new Exception("Error Processing Request", 1);// ?
-					$this->DBG("Error BBOX wrong format", __LINE__, __FUNCTION__, __CLASS__);
-				}
-			}
-		}
+		if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
 		//if ($geomFld) $searchParams["f_{$geomFld}"] = 'IS NOT NULL';
 		//if ($geomFld) $searchParams["f_{$geomFld}"] = 'GeometryType=' . strtoupper($dbGeomType);
 		$geomType = strtoupper($dbGeomType);

+ 82 - 0
SE/se-lib/Api/WfsServerBase.php

@@ -61,6 +61,88 @@ class Api_WfsServerBase {
 		return $acl;
 	}
 
+	/**
+	 * @param $_GET [ , POST Body - XML file ]
+	 * @return array $args
+	 * TODO: get $acl and check more restrictions
+	 */
+	public function parseGetFeatureArgsFromRequest() {
+		$rawArgs = $_GET;// $_REQUEST; ($_POST values not allowed, only xml in post body)
+		$args = array();
+		$args['xsd:type'] = null;// @from: TYPENAME, typeName (typename)
+		$args['typePrefix'] = null;// @from: TYPENAME, typeName (typename)
+		$args['typeName'] = null;// @from: TYPENAME, typeName (typename)
+		$args['srsname'] = null;// @from: SRSNAME (srsname)
+		$args['limit'] = 0;// @from: MAXFEATURES, maxFeatures, COUNT (maxfeatures, count)
+		$args['offset'] = 0;// @from: startIndex (startindex, count)
+		$args['ogc:filter'] = null;// @from: FILTER, Filter (filter)
+		$args['sortBy'] = null;// @from: sortBy (sortby)
+		$args['wfs:propertyName'] = null;// @from: propertyName (propertyname)
+		$args['filterFields'] = array();// array of field names to show - @from: propertyName
+		$args['resultType'] = null;// @from: resultType (resulttype)
+		$args['bbox'] = null;// @from: BBOX (bbox)
+		$args['wfs:featureID'] = null;// @from: featureID, featureId (featureid)
+		$args['primaryKey'] = null;// primaryKey type - @from: featureID
+
+		$lowerArgs = array(); foreach ($rawArgs as $name => $value) $lowerArgs[ strtolower($name) ] = $value;
+
+		$args['xsd:type'] = V::get('typename', '', $lowerArgs);
+		$exType = explode(':', $args['xsd:type']);
+		if (count($exType) != 2) throw new HttpException("Wrong param TYPENAME", 400);
+		$args['typePrefix'] = $exType[0];
+		$args['typeName'] = $exType[1];
+
+		$args['srsname'] = V::get('SRSNAME', '', $lowerArgs);// eg. EPSG:4326
+
+		$args['limit'] = V::get('maxfeatures', $args['limit'], $lowerArgs, 'int');
+		$args['limit'] = V::get('count', $args['limit'], $lowerArgs, 'int');
+		if ($args['limit'] <= 0) $args['limit'] = 10000;// default limit
+
+		$args['offset'] = V::get('startindex', 0, $lowerArgs, 'int');
+
+		$args['ogc:filter'] = urldecode(V::get('filter', '', $lowerArgs));
+		if (empty($args['ogc:filter'])) {// read ogc:Filter from POST body if not defined in GET
+			$reqBody = Request::getRequestBody();
+			if (!empty($reqBody)) {
+				$args['ogc:filter'] = $this->convertOgcFilterFromRequestBody($reqBody);
+				if (empty($args['ogc:filter'])) throw new Api_WfsException("Error Processing ogc:Filter", 501);
+			}
+		}
+
+		$args['sortBy'] = V::get('sortby', '', $lowerArgs);// TODO: split to array of array(fieldName, (asc | desc))
+
+		$args['wfs:propertyName'] = trim(V::get('propertyname', '', $lowerArgs));// TODO: fields to show - split by ','
+		if (strlen($args['wfs:propertyName']) > 0) {
+			$args['filterFields'] = array();
+			$exFields = explode(',', $args['wfs:propertyName']);
+			foreach ($exFields as $fieldName) {
+				$fieldName = trim($fieldName);
+				if (!empty($fieldName)) $args['filterFields'][] = $fieldName;
+			}
+		}
+
+		$args['resultType'] = V::get('resulttype', '', $lowerArgs);
+
+		$args['bbox'] = V::get('bbox', '', $lowerArgs);
+		if (!empty($args['bbox'])) {
+			if (!preg_match("/^\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?$/", $args['bbox'], $matches)) throw new Exception("Wrong param BBOX");
+			$searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
+		}
+
+		$args['wfs:featureID'] = V::get('featureid', null, $lowerArgs);// TODO: allow multiply feature id (csv)
+		if ($args['wfs:featureID']) {
+			$dotPos = strpos($args['wfs:featureID'], '.');
+			if (!$dotPos) throw new Exception("Wrong param fetureID");
+			if ($args['typeName'] != substr($args['wfs:featureID'], 0, $dotPos)) throw new Exception("Wrong typeName in param fetureID");
+			$args['primaryKey'] = substr($args['wfs:featureID'], $dotPos + 1);
+		}
+
+		if(DBG::isActive() && V::get('DBG', 0, $_GET)){ echo "\$lowerArgs:";print_r($lowerArgs); }
+		if(DBG::isActive() && V::get('DBG', 0, $_GET)){ echo "\$args:";print_r($args); }
+
+		return $args;
+	}
+
 	public function _getCapabilities($wfsServerUrl, $serviceTitle, $serviceDescription) {
 		echo '<?xml version="1.0" encoding="UTF-8"?>';
 		?>

+ 6 - 0
SE/se-lib/Data_Source.php

@@ -555,6 +555,12 @@ class Data_Source {
 					$sql_where_and[] = $sqlFltr;
 				}
 			}
+			else if ('primaryKey' == $k) {
+				if (!empty($v)) {
+					$primaryKeyField = $this->getPrimaryKeyField();
+					$sql_where_and[] = "t.`{$primaryKeyField}` = '" . $this->_db->_($v) . "'";
+				}
+			}
 		}
 		if (!empty($sql_where_and)) {
 			$sql_where = implode(" and ", $sql_where_and);

+ 17 - 1
SE/se-lib/ParseOgcFilter.php

@@ -4,11 +4,27 @@ Lib::loadClass('SqlQueryWhereBuilder');
 Lib::loadClass('Api_WfsException');
 
 /*
- * TODO: parse xlink query
+ * TODO: parse xlink query:
 	<ogc:PropertyIsEqualTo>
 		<ogc:PropertyName>File/@xlink:href</ogc:PropertyName>
 		<ogc:Literal>https://biuro.biall-net.pl/wfs/objects#File.45</ogc:Literal>
 	</ogc:PropertyIsEqualTo>
+ * TODO: parse bbox query:
+	<ogc:Filter xmlns:app="http://www.deegree.org/app" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">
+		<ogc:BBOX>
+			<ogc:PropertyName>app:geometry</ogc:PropertyName>
+			<gml:Envelope>
+				<gml:coord>
+					<gml:X>343720</gml:X>
+					<gml:Y>4374533</gml:Y>
+				</gml:coord>
+				<gml:coord>
+					<gml:X>444136</gml:X>
+					<gml:Y>4433308</gml:Y>
+				</gml:coord>
+			</gml:Envelope>
+		</ogc:BBOX>
+	</ogc:Filter>
  * TODO: in SqlQueryWhereBuilder split query for main database and join-ed db (right join in ref's)
  *
  * @usage: