[Mapbender-commits] r9332 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Dec 8 07:31:28 PST 2015
Author: armin11
Date: 2015-12-08 07:31:27 -0800 (Tue, 08 Dec 2015)
New Revision: 9332
Modified:
trunk/mapbender/http/classes/class_metadata_new.php
Log:
Extent search for dataset
Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php 2015-12-08 13:36:59 UTC (rev 9331)
+++ trunk/mapbender/http/classes/class_metadata_new.php 2015-12-08 15:31:27 UTC (rev 9332)
@@ -613,49 +613,87 @@
//maybe generate uuid first to find search!!
//http://localhost/mb_trunk/php/mod_callMetadata.php?searchId=test2&searchText=wald&outputFormat=json&resultTarget=web&searchResources=dataset&resolveCoupledResources=true
$coupledResources = json_decode($datasetMatrix[$i]['coupled_resources']);
+ $layerCount = 0;
+ $featuretypeCount = 0;
foreach ($coupledResources->coupledResources->layerIds as $layer_id) {
- $this->datasetJSON->dataset->srv[$i]->coupledResources->layer[] = $layer_id;
+ $this->datasetJSON->dataset->srv[$i]->coupledResources->layer[$layerCount]->id = $layer_id;
$allCoupledLayers[] = $layer_id;
- $allCoupledFeaturetypes = array();
+ $layerCount++;
}
- foreach ($coupledResources->featuretypeIds as $featuretype_id) {
- $this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype[] = $featuretype_id;
+ foreach ($coupledResources->coupledResources->featuretypeIds as $featuretype_id) {
+ //$e = new mb_exception("ft found: ".$featuretype_id);
+ $this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype[$featuretypeCount]->id = $featuretype_id;
$allCoupledFeaturetypes[] = $featuretype_id;
+ $featuretypeCount++;
}
- //$coupledLayers = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, 10, null, null, null, $this->languageCode, null, 'wms', 1, 'json', 'internal', null, null, $this->hostName, 'rank', '13751,13752' ,false , null);
- //$this->datasetJSON->dataset->srv[$i-$j]->coupledLayer = json_decode($coupledLayers->internalResult);
- //$coupledFeaturetypes = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, 10, null, null, null, $this->languageCode, null, 'wfs', 1, 'json', 'internal', null, null, $this->hostName, 'rank', '13751,13752' ,false , null);
- //$this->datasetJSON->dataset->srv[$i-$j]->coupledFeaturetypes = json_decode($coupledFeaturetypes->internalResult);
- //pull downloadoptions directly from layer downloadoptions cause they are the same !!!!
}
}
//search for coupled resources and push them into dataset json !
if ($this->resolveCoupledResources == true) {
- //$e = new mb_exception("count of all layers:".count(array_unique($allCoupledLayers)));
- //$e = new mb_exception("cs of all layers:".implode(',',array_unique($allCoupledLayers)));
- //$e = new mb_exception("count layers: ".time());
- //$csLayerIds = implode(',',array_unique($allCoupledLayers));
- //$countLayerIds = (integer)count(array_unique($allCoupledLayers));
+ $layerSearchArray = array();
+ $featuretypeSearchArray = array();
+ $downloadOptionsArray = array();
if (count($allCoupledLayers) >= 1) {
//$e = new mb_exception("invoke search");
- //$coupledLayers = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, count(array_unique($allCoupledLayers)), null, null, null, $this->languageCode, null, 'wms', 1, 'json', 'internal', null, null, $this->hostName, 'rank', implode(',',array_unique($allCoupledLayers))$csLayerIds ,false , null);
$coupledLayers = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, count(array_unique($allCoupledLayers)), null, null, null, $this->languageCode, null, 'wms', 1, 'json', 'internal', null, null, $this->hostName, 'rank',implode(',',array_unique($allCoupledLayers)) ,false , null);
- //$test = json_decode($coupledLayers->internalResult);
- //$e = new mb_exception($coupledLayers->internalResult);
+ $srvCount = 0;
+ foreach (json_decode($coupledLayers->internalResult)->wms->srv as $server) {
+ $e = new mb_exception("server id ->". $server->id);
+ foreach($server->layer as $layer) {
+ //$layerSearchArray[$layer->id] = $server->id;
+ $layerSearchArray[$layer->id] = $srvCount;
+ //pull inspire downloadoptions from layer information
+ foreach ($layer->downloadOptions as $downloadOption) {
+ if ($downloadOption->uuid != null) {
+ $downloadOptionsArray[$downloadOption->uuid] = json_encode($downloadOption->option);
+ }
+ }
+ }
+ $srvCount++;
+ }
}
//$e = new mb_exception("count featuretypes: ".time());
if (count($allCoupledFeaturetypes) >= 1) {
+ //$e = new mb_exception("some ft found");
$coupledFeaturetypes = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, count(array_unique($allCoupledFeaturetypes)), null, null, null, $this->languageCode, null, 'wfs', 1, 'json', 'internal', null, null, $this->hostName, 'rank', implode(',',array_unique($allCoupledFeaturetypes)) ,false , null);
- //$e = new mb_exception("end counting: ".time());
-
+ //$e = new mb_exception("featuretype: ".$coupledFeaturetypes->internalResult);
+ $srvCount = 0;
+ foreach (json_decode($coupledFeaturetypes->internalResult)->wfs->srv as $server) {
+ //$e = new mb_exception("wfs id: ".$server->id);
+ foreach($server->ftype as $featuretype) {
+ //$e = new mb_exception("wfs id: ".$server->id." ft id: ". $featuretype->id);
+ $featuretypeSearchArray[$featuretype->id] = $srvCount;
+
+ }
+ $srvCount++;
+ }
}
+ //insert objects into dataset result list
+ for($i=0; $i<count($datasetMatrix);$i++){
+ $layerCount = 0;
+ foreach ($this->datasetJSON->dataset->srv[$i]->coupledResources->layer as $layer) {
+ //$e = new mb_exception("layer: ".$layer->id);
+ //$e = new mb_exception("srvcount: ".$layerSearchArray[$layer->id]);
+ $this->datasetJSON->dataset->srv[$i]->coupledResources->layer[$layerCount]->srv = json_decode($coupledLayers->internalResult)->wms->srv[$layerSearchArray[$layer->id]];
+ $layerCount++;
+ }
+ $featuretypeCount = 0;
+ foreach ($this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype as $ft) {
+ $e = new mb_exception($ft->id ." in service: ". $featuretypeSearchArray[$ft->id]);
+ $this->datasetJSON->dataset->srv[$i]->coupledResources->featuretype[$featuretypeCount]->srv = json_decode($coupledFeaturetypes->internalResult)->wfs->srv[$featuretypeSearchArray[$featuretype->id]];
+ $featuretypeCount++;
+ }
+ //check for atom feed entry
+ //$e = new mb_exception("uuid: ".$datasetMatrix[$i]['fileidentifier']);
+ if ($downloadOptionsArray[$datasetMatrix[$i]['fileidentifier']] != null) {
+ //$e = new mb_exception("element found for uuid: ".$datasetMatrix[$i]['fileidentifier']);
+ $this->datasetJSON->dataset->srv[$i]->coupledResources->inspireAtomFeeds = json_decode($downloadOptionsArray[$datasetMatrix[$i]['fileidentifier']]);
+ }
+ }
}
}
-
-
-
private function generateWMSMetadataJSON($res, $n) {
//initialize object
$this->wmsJSON = new stdClass;
More information about the Mapbender_commits
mailing list