[Mapbender-commits] r8778 - trunk/mapbender/http/geoportal
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Feb 17 02:40:07 PST 2014
Author: armin11
Date: 2014-02-17 02:40:06 -0800 (Mon, 17 Feb 2014)
New Revision: 8778
Modified:
trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
Log:
Bugfix for INSPIRE monitoring csv files
Modified: trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php 2014-02-14 11:04:41 UTC (rev 8777)
+++ trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php 2014-02-17 10:40:06 UTC (rev 8778)
@@ -245,11 +245,11 @@
if ($outputFormat == 'monitoring' || $outputFormat == 'table') {
$sql = <<<SQL
-select metadata_layer.title, metadata_layer.uuid, resource_id, resource_type, service_id, inspire_download, wms_owner as service_owner, fkey_mb_group_id as service_group, wms_title as service_title, f_collect_inspire_cat_layer(resource_id) as inspire_cat from (select title,uuid, layer_id as resource_id, 'layer' as resource_type, fkey_wms_id as service_id, inspire_download from (select layer.layer_id, layer.fkey_wms_id, layer.inspire_download, layer_custom_category.fkey_custom_category_id from layer inner join layer_custom_category on layer.layer_id = layer_custom_category.fkey_layer_id where layer_custom_category.fkey_custom_category_id = $inspireCatId AND layer_searchable = 1 ORDER BY layer_id) as layer_inspire inner join (select metadata_id, uuid, title, fkey_layer_id from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_layer_id = layer_inspire.layer_id) as meta
data_layer INNER JOIN wms ON metadata_layer.service_id = wms_id
+select metadata_layer.title, metadata_layer.uuid, resource_id, resource_uuid, resource_type, inspire_actual_coverage, inspire_whole_area, service_id, inspire_download, wms_owner as service_owner, fkey_mb_group_id as service_group, wms_title as service_title, f_collect_inspire_cat_layer(resource_id) as inspire_cat from (select title,uuid ,resource_uuid, layer_id as resource_id, 'layer' as resource_type, fkey_wms_id as service_id, inspire_download, inspire_actual_coverage, inspire_whole_area from (select layer.layer_id, layer.fkey_wms_id, layer.uuid as resource_uuid, layer.inspire_download, layer_custom_category.fkey_custom_category_id from layer inner join layer_custom_category on layer.layer_id = layer_custom_category.fkey_layer_id where layer_custom_category.fkey_custom_category_id = $inspireCatId AND layer_searchable = 1 ORDER BY layer_id) as layer_inspire inner join (select metadata_id, uuid, title, inspire_actual_coverage, inspire_whole_area, fkey_layer_id from mb_metada
ta inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_layer_id = layer_inspire.layer_id) as metadata_layer INNER JOIN wms ON metadata_layer.service_id = wms_id
union
-select metadata_featuretype.title, metadata_featuretype.uuid, resource_id, resource_type, service_id, inspire_download, wfs_owner as service_owner, fkey_mb_group_id as service_group, wfs_title as service_title, f_collect_inspire_cat_wfs_featuretype(resource_id) as inspire_cat from (select title, uuid, featuretype_id as resource_id, 'wfs_featuretype' as resource_type, fkey_wfs_id as service_id, inspire_download from (select wfs_featuretype.featuretype_id ,wfs_featuretype.fkey_wfs_id, wfs_featuretype.inspire_download from wfs_featuretype) as featuretype_inspire inner join (select metadata_id, uuid, title, fkey_featuretype_id from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_featuretype_id = featuretype_inspire.featuretype_id) as metadata_featuretype INNER JOIN wfs ON metadata_featuretype.service_id = wfs_id
+select metadata_featuretype.title, metadata_featuretype.uuid, resource_id, resource_uuid, resource_type,inspire_actual_coverage, inspire_whole_area, service_id, inspire_download, wfs_owner as service_owner, fkey_mb_group_id as service_group, wfs_title as service_title, f_collect_inspire_cat_wfs_featuretype(resource_id) as inspire_cat from (select title, uuid, resource_uuid, featuretype_id as resource_id, 'wfs_featuretype' as resource_type, fkey_wfs_id as service_id, inspire_download, inspire_actual_coverage, inspire_whole_area from (select wfs_featuretype.featuretype_id ,wfs_featuretype.fkey_wfs_id, wfs_featuretype.inspire_download, wfs_featuretype.uuid as resource_uuid from wfs_featuretype) as featuretype_inspire inner join (select metadata_id, uuid, title, fkey_featuretype_id, inspire_actual_coverage, inspire_whole_area from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_re
lation.fkey_featuretype_id = featuretype_inspire.featuretype_id) as metadata_featuretype INNER JOIN wfs ON metadata_featuretype.service_id = wfs_id
order by uuid
SQL;
@@ -292,6 +292,8 @@
$sqlTable['resource_uuid'][] = $row['resource_uuid'];
$sqlTable['service_group'][] = $row['service_group'];
$sqlTable['service_owner'][] = $row['service_owner'];
+ $sqlTable['inspire_actual_coverage'][] = $row['inspire_actual_coverage'];
+ $sqlTable['inspire_whole_area'][] = $row['inspire_whole_area'];
$sqlTable['inspire_cat'][] = replaceCategories($row['inspire_cat'], $inspireCategories);
$sqlTable['inspire_cat_monitoring'][] = replaceCategoriesList($row['inspire_cat']);
$sqlTable['inspire_download'][] = $row['inspire_download'];
@@ -376,7 +378,7 @@
"services" => array(),
"organizations" => array()
);
-
+ //loop over all found metadata uuids
for ($i=0; $i < count($sqlTable['uuid']); $i++){
//filter for orga_id
//generate entry only if orga_id is the same as expected
@@ -393,8 +395,8 @@
//logit($inspireMonitoring['datasets'][$metadataIndex]->title);
$inspireMonitoring['datasets'][$metadataIndex]->organization = $sqlTable['organization'][$i];
$inspireMonitoring['datasets'][$metadataIndex]->orgaEmail = $sqlTable['orgaEmail'][$i];
- $inspireMonitoring['datasets'][$metadataIndex]->relevantArea = "";
- $inspireMonitoring['datasets'][$metadataIndex]->actualArea = "";
+ $inspireMonitoring['datasets'][$metadataIndex]->relevantArea = $sqlTable['inspire_whole_area'][$i];
+ $inspireMonitoring['datasets'][$metadataIndex]->actualArea = $sqlTable['inspire_actual_coverage'][$i];
$inspireMonitoring['datasets'][$metadataIndex]->metadataExists = "[X]";
$inspireMonitoring['datasets'][$metadataIndex]->uuid = $sqlTable['uuid'][$i];
//metadata conform
@@ -431,7 +433,7 @@
//addview view service
$inspireMonitoring['services'][$serviceIndex]->id = $sqlTable['resource_uuid'][$i];
//name
- $inspireMonitoring['services'][$serviceIndex]->name = $sqlTable['service_title'][$i];
+ $inspireMonitoring['services'][$serviceIndex]->name = "Darstellungsdienst für ".$sqlTable['title'][$i];
//typ
$inspireMonitoring['services'][$serviceIndex]->type = "Darstellungsdienst";
//url
@@ -473,7 +475,7 @@
}
//$e = new mb_exception("generate downloadservice");
- //if (!in_array($sqlTable['uuid'][$i],$alreadyBuildDls)) {
+ if (!in_array($sqlTable['uuid'][$i],$alreadyBuildDls)) {
//initialize array of uuids which are already tested for downloadservices!
//the options are all the same for one single metadata uuid - therefor this has only to be done once for a uuid!
//the service information is pulled from the first organization - TODO - maybe change this?
@@ -491,7 +493,7 @@
}
if ($downloadOptions != null) {
$mdUuid = $sqlTable['uuid'][$i];
- //$alreadyBuildDls[] = $mdUuid;
+
foreach ($downloadOptions->{$mdUuid}->option as $option) {
//create download service entries
//create ids for download services on the fly
@@ -504,7 +506,7 @@
//wmsgetmap
//LAYER uuid (12-4), Type (4) - 0002, MD uuid (4-8)
//
- if (isset($sqlTable['service_uuid'][$i]) && $sqlTable['service_uuid'][$i] != '' ) { //TODO - don't use service uuids from table but from options!
+ //if (isset($sqlTable['service_uuid'][$i]) && $sqlTable['service_uuid'][$i] != '' ) { //TODO - don't use service uuids from table but from options!
//TODO - what to do if metadata id is no uuid?????
$uuid = new Uuid();
$uuidTest = $uuid->isuuid($mdUuid);
@@ -543,12 +545,13 @@
}
- } else {
+ /*} else {
//generate dummy uuid - is not good!
- $uuid = new Uuid();
- $dlsFileIdentifier = $uuid;
+ //$uuid = new Uuid();
+ //$dlsFileIdentifier = $uuid;
$dlsFileIdentifier = "00000000-0000-0000-000000000000";
- }
+ }*/
+
if (!in_array($dlsFileIdentifier,$alreadyBuildDls)) {
//generate the rest of the service element
//addview view service
@@ -588,7 +591,7 @@
}
}
- //}
+ }
//$e = new mb_exception("generate organization entry");
if (!in_array($sqlTable['organization'][$i],$alreadyReadOrgas)) {
$alreadyReadOrgas[] = $sqlTable['organization'][$i];
@@ -681,7 +684,7 @@
$html .= $row;
}
header('Content-type: application/octetstream');
- header('Content-Length: ' . filesize($html));
+ header('Content-Length: ' . strlen($html));
header('Content-Disposition: attachment; filename="datasets.csv"');
echo $html;
break;
@@ -707,7 +710,7 @@
$html .= $row;
}
header('Content-type: application/octetstream');
- header('Content-Length: ' . filesize($html));
+ header('Content-Length: ' . strlen($html));
header('Content-Disposition: attachment; filename="services.csv"');
echo $html;
break;
@@ -722,7 +725,7 @@
$html .= $row;
}
header('Content-type: application/octetstream');
- header('Content-Length: ' . filesize($html));
+ header('Content-Length: ' . strlen($html));
header('Content-Disposition: attachment; filename="organizations.csv"');
echo $html;
break;
More information about the Mapbender_commits
mailing list