|
@@ -139,9 +139,8 @@ class Api_WfsDataServer extends Api_WfsServerBase {
|
|
|
if (!empty($args['filterFields'])) $searchParams['cols'] = $args['filterFields'];// propertyName
|
|
if (!empty($args['filterFields'])) $searchParams['cols'] = $args['filterFields'];// propertyName
|
|
|
if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];// featureID
|
|
if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];// featureID
|
|
|
if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
|
|
if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
|
|
|
- DBG::log([ 'msg'=>"getTotal() - searchParams", '$searchParams'=>$searchParams ]);
|
|
|
|
|
- $totalItems = $acl->getTotal($searchParams);
|
|
|
|
|
- DBG::log([ 'msg'=>"getTotal() - total", '$totalItems'=>$totalItems ]);
|
|
|
|
|
|
|
+ $queryFeatures = $acl->buildQuery($searchParams);
|
|
|
|
|
+ $totalItems = $queryFeatures->getTotal();
|
|
|
|
|
|
|
|
$xmlWriter = new XMLWriter();
|
|
$xmlWriter = new XMLWriter();
|
|
|
if (!$xmlWriter) throw new HttpException("Error no XMLWriter", 404);
|
|
if (!$xmlWriter) throw new HttpException("Error no XMLWriter", 404);
|
|
@@ -201,7 +200,9 @@ class Api_WfsDataServer extends Api_WfsServerBase {
|
|
|
if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];// featureID
|
|
if (!empty($args['primaryKey'])) $searchParams['primaryKey'] = $args['primaryKey'];// featureID
|
|
|
if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
|
|
if (!empty($args['bbox'])) $searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
|
|
|
DBG::log([ 'msg'=>'getItems - $searchParams', '$searchParams'=>$searchParams ]);
|
|
DBG::log([ 'msg'=>'getItems - $searchParams', '$searchParams'=>$searchParams ]);
|
|
|
- $items = $acl->getItems($searchParams);
|
|
|
|
|
|
|
+ if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">get_total (F.' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($jsonData->total);echo'</pre>';}
|
|
|
|
|
+ $queryFeatures = $acl->buildQuery($searchParams);
|
|
|
|
|
+ $items = $queryFeatures->getItems();
|
|
|
DBG::log([ 'msg'=>'getItems - $items', '$items'=>$items ]);
|
|
DBG::log([ 'msg'=>'getItems - $items', '$items'=>$items ]);
|
|
|
|
|
|
|
|
header('Content-type: application/xml; charset=utf-8');
|
|
header('Content-type: application/xml; charset=utf-8');
|
|
@@ -213,7 +214,7 @@ class Api_WfsDataServer extends Api_WfsServerBase {
|
|
|
$xmlWriter->startDocument('1.0','UTF-8');
|
|
$xmlWriter->startDocument('1.0','UTF-8');
|
|
|
//$xmlWriter->startElementNS('wfs', 'FeatureCollection', 'http://www.opengis.net/wfs');
|
|
//$xmlWriter->startElementNS('wfs', 'FeatureCollection', 'http://www.opengis.net/wfs');
|
|
|
$xmlWriter->startElement('wfs:FeatureCollection');
|
|
$xmlWriter->startElement('wfs:FeatureCollection');
|
|
|
-// $xmlWriter->writeAttributeNS('xmlns', 'wfs', 'http://www.w3.org/2000/xmlns/', 'http://www.opengis.net/wfs');
|
|
|
|
|
|
|
+ // $xmlWriter->writeAttributeNS('xmlns', 'wfs', 'http://www.w3.org/2000/xmlns/', 'http://www.opengis.net/wfs');
|
|
|
$xmlWriter->writeAttribute('xmlns:wfs', 'http://www.opengis.net/wfs');
|
|
$xmlWriter->writeAttribute('xmlns:wfs', 'http://www.opengis.net/wfs');
|
|
|
$xmlWriter->writeAttribute('xmlns', 'http://www.opengis.net/wfs');
|
|
$xmlWriter->writeAttribute('xmlns', 'http://www.opengis.net/wfs');
|
|
|
$xmlWriter->writeAttribute('xmlns:gml', 'http://www.opengis.net/gml');
|
|
$xmlWriter->writeAttribute('xmlns:gml', 'http://www.opengis.net/gml');
|
|
@@ -222,6 +223,9 @@ class Api_WfsDataServer extends Api_WfsServerBase {
|
|
|
$xmlWriter->writeAttribute("xmlns:{$wfsNs}", $wfsNsUri);
|
|
$xmlWriter->writeAttribute("xmlns:{$wfsNs}", $wfsNsUri);
|
|
|
if (!$simple) $xmlWriter->writeAttribute("xmlns:{$rootWfsNs}", $rootWfsNsUri);
|
|
if (!$simple) $xmlWriter->writeAttribute("xmlns:{$rootWfsNs}", $rootWfsNsUri);
|
|
|
$xmlWriter->writeAttribute('xsi:schemaLocation', "{$wfsNsUri} {$featureTypeUri}");
|
|
$xmlWriter->writeAttribute('xsi:schemaLocation', "{$wfsNsUri} {$featureTypeUri}");
|
|
|
|
|
+ $xmlWriter->writeAttribute('numberMatched', 'unknown'); // TODO: return total items if simple query (without prefix, small total number, maxFeatures set, etc.)
|
|
|
|
|
+ // NOTE: for client: if numberMatched == 'unknown' then request with resultType = 'hits'
|
|
|
|
|
+ $xmlWriter->writeAttribute('numberReturned', count($items));
|
|
|
|
|
|
|
|
$tblName = $acl->getName();
|
|
$tblName = $acl->getName();
|
|
|
$primaryKeyField = $acl->getPrimaryKeyField();
|
|
$primaryKeyField = $acl->getPrimaryKeyField();
|