Parcourir la source

added xlink as GetFeature arg

Piotr Labudda il y a 8 ans
Parent
commit
123800c2de

+ 8 - 2
SE/se-lib/Api/WfsDataServer.php

@@ -176,8 +176,14 @@ class Api_WfsDataServer extends Api_WfsServerBase {
 			$searchParams['order_dir'] = 'DESC';
 		}
 		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['filterFields'])) $searchParams['cols'] = $args['filterFields']; // PropertyName
+		if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];
+		if (!empty($args['xlink'])) {
+			$expectedUrl = Api_WfsNs::getBaseWfsUri() . "/" . $acl->getNamespace() . ".";
+			if ($expectedUrl !== substr($args['xlink'], 0, strlen($expectedUrl))) throw new Exception("Wrong xlink url");
+			$primaryKey = substr($args['xlink'], strlen($expectedUrl));
+			$searchParams['primaryKey'] = $primaryKey;
+		}
 		if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
 
 		DBG::log($args, 'array', "\$args");

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

@@ -88,6 +88,7 @@ class Api_WfsServerBase {
 		$args['bbox'] = null;// @from: BBOX (bbox)
 		$args['wfs:featureID'] = null;// @from: featureID, featureId (featureid)
 		$args['primaryKey'] = null;// primaryKey type - @from: featureID or $req[primaryKey]
+		$args['xlink'] = V::get('xlink', '', $rawArgs); // xlink = "https://biuro.biall-net.pl/wfs/default_db/CRM_PROCES#PROCES.100" but with '#' replaced with '/'
 		$args['outputBlobFormat'] = V::get('outputBlobFormat', 'base64', $rawArgs); // how to print blob fields ('base64', 'link') - default base64
 		$args['resolve'] = V::get('resolve', '', $rawArgs);
 		$args['resolveDepth'] = V::get('resolveDepth', 0, $rawArgs, 'int'); // TODO: if ('*' === resolveDepth) - recurse resolve

+ 1 - 0
SE/static/p5WFS/GetFeature.js

@@ -128,6 +128,7 @@ function p5WFS_GetFeature(typeName, query) { // @returns Promise
 	if ('primaryKey' in query) link += '&primaryKey=' + query['primaryKey']
 	if ('resolve' in query) link += '&resolve=' + query['resolve']
 	if ('resolveDepth' in query) link += '&resolveDepth=' + query['resolveDepth']
+	if ('xlink' in query) link += '&xlink=' + query['xlink'] // NOTE: replace '#' to '/'
 	var method = (postData) ? 'POST' : 'GET'
 
 	return window.fetch(link, Object.assign({