[Mapbender-commits] r8385 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jun 18 13:48:31 PDT 2012
Author: armin11
Date: 2012-06-18 13:48:30 -0700 (Mon, 18 Jun 2012)
New Revision: 8385
Modified:
trunk/mapbender/http/php/mod_inspireDownloadFeed.php
Log:
Bugfixes for INSPIRE predefined download services by usage of georss feeds - need little further work.
Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php 2012-06-18 14:42:33 UTC (rev 8384)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php 2012-06-18 20:48:30 UTC (rev 8385)
@@ -171,7 +171,6 @@
global $admin, $type, $imageResolution, $maxImageSize, $maxFeatureCount, $mapbenderMetadata, $indexMapbenderMetadata, $layerId, $wfsId;
switch ($generateFrom) {
-
case "dataurl":
$sql = <<<SQL
select *, 'dataurl' as origin from (select * from (select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey_layer_id = layer_metadata.layer_id) as layer_relation_data inner join datalink on layer_relation_data.fkey_datalink_id
= datalink.datalink_id) as layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326';
@@ -181,27 +180,27 @@
case "wmslayer":
$sql = <<<SQL
-select *, 'wmslayer' as origin from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326' and layer_wms.layer_id = $2;
+select *, 'wmslayer' as origin from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id,layer_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326' and layer_w
ms.layer_id = $2;
SQL;
break;
case "wfs":
$sql = <<<SQL
-select *, 'wfs' as origin from (select mb_metadata.metadata_id, featuretype_relation.featuretype_name, featuretype_relation.fkey_wfs_id, featuretype_relation.featuretype_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, featuretype_relation.featuretype_title, featuretype_relation.featuretype_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, featuretype_relation.featuretype_latlon_bbox as latlonbbox, featuretype_relation.featuretype_srs from (select * from wfs_featuretype inner join ows_relation_metadata on wfs_featuretype.featuretype_id = ows_relation_metadata.fkey_featuretype_id) as featuretype_relation inner join mb_metadata on featuretype_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as featuretype_data inner join wfs on feature
type_data.fkey_wfs_id = wfs.wfs_id where wfs.wfs_id = $2;
+select *, 'wfs' as origin from (select mb_metadata.metadata_id, featuretype_relation.featuretype_name, featuretype_relation.fkey_wfs_id, featuretype_relation.featuretype_id,featuretype_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, featuretype_relation.featuretype_title, featuretype_relation.featuretype_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, featuretype_relation.featuretype_latlon_bbox as latlonbbox, featuretype_relation.featuretype_srs from (select * from wfs_featuretype inner join ows_relation_metadata on wfs_featuretype.featuretype_id = ows_relation_metadata.fkey_featuretype_id) as featuretype_relation inner join mb_metadata on featuretype_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as feat
uretype_data inner join wfs on featuretype_data.fkey_wfs_id = wfs.wfs_id where wfs.wfs_id = $2;
SQL;
break;
case "all":
$sql = array();
$sql[0] = <<<SQL
-select *, 'dataurl' as origin from (select * from (select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey_layer_id = layer_metadata.layer_id) as layer_relation_data inner join datalink on layer_relation_data.fkey_datalink_id
= datalink.datalink_id) as layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326'
+select *, 'dataurl' as origin from (select * from (select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id,layer_relation.inspire_download, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey_layer_id = layer_metadata.layer_id) as layer_relation_data inner join datalink on layer
_relation_data.fkey_datalink_id = datalink.datalink_id) as layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326'
SQL;
$sql[1] = <<<SQL
-select *, 'wmslayer' as origin from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326';
+select *, 'wmslayer' as origin from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name,layer_relation.inspire_download, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326';
SQL;
$sql[2] = <<<SQL
-select *, 'wfs' as origin from (select mb_metadata.metadata_id, featuretype_relation.featuretype_name, featuretype_relation.fkey_wfs_id, featuretype_relation.featuretype_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, featuretype_relation.featuretype_title, featuretype_relation.featuretype_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, featuretype_relation.featuretype_latlon_bbox as latlonbbox, featuretype_relation.featuretype_srs from (select * from wfs_featuretype inner join ows_relation_metadata on wfs_featuretype.featuretype_id = ows_relation_metadata.fkey_featuretype_id) as featuretype_relation inner join mb_metadata on featuretype_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as featuretype_data inner join wfs on feature
type_data.fkey_wfs_id = wfs.wfs_id;
+select *, 'wfs' as origin from (select mb_metadata.metadata_id, featuretype_relation.featuretype_name, featuretype_relation.fkey_wfs_id, featuretype_relation.inspire_download, featuretype_relation.featuretype_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, featuretype_relation.featuretype_title, featuretype_relation.featuretype_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value, mb_metadata.datasetid_codespace, featuretype_relation.featuretype_latlon_bbox as latlonbbox, featuretype_relation.featuretype_srs from (select * from wfs_featuretype inner join ows_relation_metadata on wfs_featuretype.featuretype_id = ows_relation_metadata.fkey_featuretype_id) as featuretype_relation inner join mb_metadata on featuretype_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as fea
turetype_data inner join wfs on featuretype_data.fkey_wfs_id = wfs.wfs_id;
SQL;
break;
}
@@ -216,21 +215,21 @@
$v = array($recordId);
$t = array('s');
$res = db_prep_query($sql,$v,$t);
- fillMapbenderMetadata($res);
+ fillMapbenderMetadata($res, $generateFrom);
break;
case "wmslayer":
//only one sql should be done
$v = array($recordId, $layerId);
$t = array('s','i');
$res = db_prep_query($sql,$v,$t);
- fillMapbenderMetadata($res);
+ fillMapbenderMetadata($res, $generateFrom);
break;
case "wfs":
//only one sql should be done
$v = array($recordId, $wfsId);
$t = array('s','i');
$res = db_prep_query($sql,$v,$t);
- fillMapbenderMetadata($res);
+ fillMapbenderMetadata($res, $generateFrom);
break;
case "all": //TODO: Maybe a union is a better way, but the sql must be harmonized before
for ($i = 0; $i < 3; $i++) {
@@ -399,7 +398,15 @@
if ($type == 'SERVICE') {
$selfReference = "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_inspireDownloadFeed.php?ID=".$recordId."&type=SERVICE&generatefrom=".$generateFrom;
} else { //DATASET
- $selfReference = "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_inspireDownloadFeed.php?ID=".$recordId."&type=DATASET&generatefrom=".$generateFrom; //TODO: add layerid and wfsid
+ $selfReference = "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_inspireDownloadFeed.php?ID=".$recordId."&type=DATASET&generatefrom=".$generateFrom;
+ switch($generateFrom) {
+ case "wmslayer":
+ $selfReference .= "&layerid=".$mapbenderMetadata[$m]->layer_id;
+ break;
+ case "wfs":
+ $selfReference .= "&wfsid=".$mapbenderMetadata[$m]->wfs_id;
+ break;
+ }
}
//<link href="http://xyz.org/data" rel="self" type="application/atom+xml" hreflang="en" title="This document"/>
@@ -539,6 +546,7 @@
$nCols = ceil($diffXPx / floatval($maxImageSize));
$e = new mb_exception($nRows.":".$nCols);
$bboxWms = array();
+ $bboxWmsWS84 = array();
/*echo $diffXPx.":".$diffYPx.",";
echo $nRows.":".$nCols.",";
echo $minx.":".$miny.",";
@@ -557,6 +565,7 @@
$maxyWms = $miny + ($j+1) * $incY;
//echo "maxyWms: ". $maxyWms .",";
$bboxWms[] = $minxWms.",".$minyWms.",".$maxxWms.",".$maxyWms;
+ $bboxWmsWGS84[] = transformBbox($minxWms.",".$minyWms.",".$maxxWms.",".$maxyWms,intval($epsgId[1]),4326);
}
}
}
@@ -569,6 +578,10 @@
//generate Download Links for the different featuretypes
//first calculate the number of tiles for the different featureTypes
$featureHits = array();
+ $getFeatureLink = array();
+ $featureTypeName = array();
+ $featureTypeBbox = array();
+ $featureTypeBboxWGS84 = array();
//For each featuretype which was found! Maybe more than one!
for ($i = 0; $i < $countRessource; $i++) {
$crs = $mapbenderMetadata[$i]->metadata_ref_system;
@@ -578,8 +591,12 @@
$gHLink .= $mapbenderMetadata[$i]->wfs_version."&typeName=";
$gHLink .= $mapbenderMetadata[$i]->featuretype_name."&resultType=hits";
//echo $gHLink;
+ $startRequestTime = time();
$hitConnector = new connector($gHLink);
$hitXml = $hitConnector->file;
+ $endRequestTime = time();
+ $diffTime = $endRequestTime-$startRequestTime;
+ $e = new mb_exception("Time for counting objects of featuretype ".$mapbenderMetadata[$i]->featuretype_name." : ".$diffTime." seconds!");
//$e = new mb_exception($hitXml);
//parse hits
try {
@@ -593,6 +610,7 @@
}
$hits = $featureTypeHits->xpath('/wfs:FeatureCollection/@numberOfFeatures');
$featureHits[$i] = (integer)$hits[0];
+ $e = new mb_exception($featureHits[$i]." hits for featuretype ".$mapbenderMetadata[$i]->featuretype_name);
//$e = new mb_exception($featureHits[$i]);
//calculate further bboxes if the # of hits extents some value
@@ -649,10 +667,14 @@
$maxyWfs = $miny + ($j+1) * $width;
//echo "maxyWms: ". $maxyWms .",";
$bboxWfs[$mapbenderMetadata[$i]->featuretype_name][$countBbox] = $minxWfs.",".$minyWfs.",".$maxxWfs.",".$maxyWfs;
+ //transform bbox back to geographic coordinates
+ $featureTypeBboxWGS84[] = transformBbox($minxWfs.",".$minyWfs.",".$maxxWfs.",".$maxyWfs,intval($epsgId[1]),4326);
+ //$e = new mb_exception($test);
+
$countBbox++;
}
}
- $getFeatureLink = array();
+ //$getFeatureLink = array();
/*TODO for ($i = 0; $i < $countRessource-1; $i++) {
$gFLink = $mapbenderMetadata[$i]->wfs_getfeature."SERVICE=WFS&REQUEST=GetFeature&VERSION=";
$gFLink .= $mapbenderMetadata[$i]->wfs_version."&typeName=".$mapbenderMetadata[$i]->featuretype_name;
@@ -670,7 +692,8 @@
$bboxFilter .= '<gml:Box>';
$bboxFilter .= '<gml:coordinates>';
$currentBbox = explode(',',$bboxWfs[$mapbenderMetadata[$i]->featuretype_name][$l]);
-
+
+ $e = new mb_exception("Bounding box ".$l." : ".$l.$bboxWfs[$mapbenderMetadata[$i]->featuretype_name][$l]);
$bboxFilter .= $currentBbox[0].','.$currentBbox[1].' '.$currentBbox[2].','.$currentBbox[3];
$bboxFilter .= '</gml:coordinates></gml:Box></BBOX></Filter>';
$bboxFilter = urlencode($bboxFilter);
@@ -680,8 +703,12 @@
$gFLink .= "&maxFeatures=".$featureHits[$i]."&srsName=".$mapbenderMetadata[$i]->featuretype_srs;
$gFLink .= "&FILTER=".$bboxFilter;
$getFeatureLink[] = $gFLink;
+ $featureTypeName[] = $mapbenderMetadata[$i]->featuretype_name;
+ $featureTypeBbox[] = $bboxWfs[$mapbenderMetadata[$i]->featuretype_name][$l];
+
}
- $numberOfTiles = count($bboxWfs[$mapbenderMetadata[$i]->featuretype_name]);
+ //$numberOfTiles = count($bboxWfs[$mapbenderMetadata[$i]->featuretype_name]);
+ //$e = new mb_exception("Number of tiles for wfs predefined download service: ".$numberOfTiles);
}
} else { //type SERVICE was set - generate one entry for each coupled resource - they are distinguished by names, titles, ids, bbox, type of download!
@@ -712,7 +739,18 @@
}
$feedEntryTitle->appendChild($feedDoc->createTextNode("Feed Entry für: ".$ressourceServiceFeedEntryTitle)); //TODO: maybe add some category?
} else {
- $feedEntryTitle->appendChild($feedDoc->createTextNode($ressourceTitle. " im CRS ".$mapbenderMetadata[$i]->metadata_ref_system." und Format ".$mapbenderMetadata[$i]->format)); //TODO: maybe add some category?
+ switch ($mapbenderMetadata[$i]->origin) {
+ case "wmslayer":
+ $ressourceDataFeedEntryTitle = $ressourceTitle." - generiert aus WMS Datenquelle";
+ break;
+ case "dataurl":
+ $ressourceDataFeedEntryTitle = $ressourceTitle." - generiert aus WMS Capabilities dataURL Element";
+ break;
+ case "wfs":
+ $ressourceDataFeedEntryTitle = $ressourceTitle." - generiert über WFS GetFeature Aufrufe";
+ break;
+ }
+ $feedEntryTitle->appendChild($feedDoc->createTextNode($ressourceDataFeedEntryTitle. " im CRS ".$mapbenderMetadata[$i]->metadata_ref_system." und Format ".$mapbenderMetadata[$i]->format)); //TODO: maybe add some category?
}
$feedEntry->appendChild($feedEntryTitle);
@@ -779,8 +817,8 @@
$furtherLinkTitle = $ressourceTitle." im CRS ".$mapbenderMetadata[$i]->metadata_ref_system."(".$mapbenderMetadata[$m]->format.")";
break;
case "wmslayer":
- //example:
- //http://localhost/cgi-bin/mapserv?map=/data/umn/geoportal/karte_rp/testinspiredownload.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=inspirewms&STYLES=&SRS=EPSG:4326&BBOX=6.92134,50.130465,6.93241,50.141535000000005&WIDTH=200&HEIGHT=200&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage
+ //example:
+ //http://localhost/cgi-bin/mapserv?map=/data/umn/geoportal/karte_rp/testinspiredownload.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=inspirewms&STYLES=&SRS=EPSG:4326&BBOX=6.92134,50.130465,6.93241,50.141535000000005&WIDTH=200&HEIGHT=200&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage
//generate further links, one for each tile which was computed before
$furtherLink = array();
$furtherLinkType = array();
@@ -793,7 +831,17 @@
$furtherLinkType[$m] = "image/tiff"; //formats from layer_format - geotiff
$currentTileIndex = $m+1;
$furtherLinkTitle[$m] = $ressourceTitle." im CRS ".$mapbenderMetadata[$i]->metadata_ref_system." - ".$mapbenderMetadata[$i]->format." - Teil ".$currentTileIndex." von ".$numberOfTiles."";
- $furtherLinkBbox[$m] = $bboxWms[$m];
+ //$furtherLinkBbox[$m] = $bboxWms[$m];
+ $furtherLinkBbox[$m] = $bboxWmsWGS84[$m];
+ //generate content link
+ $feedEntryLink = $feedDoc->createElement("link");
+ $feedEntryLink->setAttribute("rel", "section");
+ $feedEntryLink->setAttribute("href", $furtherLink[$m]);
+ $feedEntryLink->setAttribute("type", $furtherLinkType[$m]);
+ $feedEntryLink->setAttribute("hreflang", "de");
+ $feedEntryLink->setAttribute("title", $furtherLinkTitle[$m]);
+ $feedEntryLink->setAttribute("bbox", $furtherLinkBbox[$m]);
+ $feedEntry->appendChild($feedEntryLink);
}
break;
case "wfs":
@@ -803,26 +851,27 @@
$furtherLinkType = array();
$furtherLinkTitle = array();
$furtherLinkBbox = array();
- for ($m = 0; $m < $numberOfTiles; $m++ ) {
+ //loop for each featuretype
+ $e = new mb_exception("Count of wfs links: ".count($getFeatureLink));
+ for ($m = 0; $m < count($getFeatureLink); $m++ ) {
$furtherLink[$m] = $getFeatureLink[$m];//was computed before
- $furtherLinkType[$m] = "text/xml; subtype=gml/3.1.1";//$mapbenderMetadata[$m]->datalink_format; //formats from layer_format - geotiff
- $furtherLinkTitle[$m] = $ressourceTitle." im CRS ".$mapbenderMetadata[$i]->metadata_ref_system."(".$mapbenderMetadata[$i]->format." - Teil ".$m + 1 ." von ".$numberOfTiles."";
- $furtherLinkBbox[$m] = $bboxWfs[$mapbenderMetadata[$i]->featuretype_name][$m];
+ $furtherLinkType[$m] = "text/xml; subtype=gml/3.1.1";//TODO: set right format for wfs version!
+ $currentIndex = $m+1;
+ $furtherLinkTitle[$m] = $ressourceTitle." im CRS ".$mapbenderMetadata[$i]->metadata_ref_system." - ".$mapbenderMetadata[$i]->format." - Teil ".$currentIndex." von ".count($getFeatureLink)."";//TODO: set right format for wfs version!
+ //$furtherLinkBbox[$m] = $featureTypeBbox[$m];
+ $furtherLinkBbox[$m] = $featureTypeBboxWGS84[$m];
+ //generate content links
+ $feedEntryLink = $feedDoc->createElement("link");
+ $feedEntryLink->setAttribute("rel", "section");
+ $feedEntryLink->setAttribute("href", $furtherLink[$m]);
+ $feedEntryLink->setAttribute("type", $furtherLinkType[$m]);
+ $feedEntryLink->setAttribute("hreflang", "de");
+ $feedEntryLink->setAttribute("title", $furtherLinkTitle[$m]);
+ $feedEntryLink->setAttribute("bbox", $furtherLinkBbox[$m]);
+ $feedEntry->appendChild($feedEntryLink);
}
break;
}
- //generate content link
- for ($m = 0; $m < $numberOfTiles; $m++) {
- //generate Links
- $feedEntryLink = $feedDoc->createElement("link");
- $feedEntryLink->setAttribute("rel", "section");
- $feedEntryLink->setAttribute("href", $furtherLink[$m]);
- $feedEntryLink->setAttribute("type", $furtherLinkType[$m]);
- $feedEntryLink->setAttribute("hreflang", "de");
- $feedEntryLink->setAttribute("title", $furtherLinkTitle[$m]);
- $feedEntryLink->setAttribute("bbox", $furtherLinkBbox[$m]);
- $feedEntry->appendChild($feedEntryLink);
- }
}
//In the case of dynamically build entries for a raster based wms - not the dataurl but another the dyn ulrs will be used in the next feed
//5.1.14 / 5.2
@@ -922,18 +971,42 @@
die();
}
-function fillMapbenderMetadata($dbResult) {
+function transformBbox($oldBbox, $fromCRS, $toCRS) {
+ //Transform the given BBOX to $toCRS
+ $arrayBbox = explode(',',$oldBbox);
+ //$e = new mb_exception($oldBbox);
+ //$e = new mb_exception(count($arrayBbox));
+ //$e = new mb_exception($arrayBbox[0]);
+ $sql = "select asewkt(transform(GeometryFromText ( 'LINESTRING ( ".$arrayBbox[0]." ".$arrayBbox[1].",".$arrayBbox[2]." ".$arrayBbox[3]." )', $fromCRS ),".intval($toCRS)."))";
+ //$sql = "select asewkt(transform(GeometryFromText ( 'LINESTRING ( $1 $2, $3 $4 )', $5 ),$6))";
+ //$v = array($arrayBbox[0],$arrayBbox[1],$arrayBbox[2],$arrayBbox[3],$fromCRS,$toCRS);
+ //$t = array('s','s','s','s','i','i');
+ $res = db_query($sql,$v,$t);
+ //read out result
+ $textBbox = db_fetch_row($res);
+ $pattern = '~LINESTRING\((.*)\)~i';
+ preg_match($pattern, $textBbox[0], $subpattern);
+ //exchange blancs
+ $newBbox = str_replace(" ", ",", $subpattern[1]);
+ //set new BBOX
+ //$arrayBboxNew = explode(',',$newBbox);
+ return $newBbox;
+}
+
+
+function fillMapbenderMetadata($dbResult, $generateFrom) {
//function increments $indexMapbenderMetadata !!!
global $mapbenderMetadata, $indexMapbenderMetadata;
//echo "<error>fill begins</error>";
while ($row = db_fetch_assoc($dbResult)) {
//get relevant information
//echo "<error>".$indexMapbenderMetadata."</error>";
+ if ($row['inspire_download'] == '1') {
$mapbenderMetadata[$indexMapbenderMetadata]->origin = $row['origin'];
$mapbenderMetadata[$indexMapbenderMetadata]->latlonbbox = $row['latlonbbox'];
$mapbenderMetadata[$indexMapbenderMetadata]->datalink_id = $row['datalink_id'];
$mapbenderMetadata[$indexMapbenderMetadata]->metadata_id = $row['metadata_id'];
- $mapbenderMetadata[$indexMapbenderMetadata]->metadata_ref_system = $row['metadata_ref_system'];
+ $mapbenderMetadata[$indexMapbenderMetadata]->metadata_ref_system = $row['metadata_ref_system'];
$mapbenderMetadata[$indexMapbenderMetadata]->fkey_mb_group_id = $row['fkey_mb_group_id'];
$mapbenderMetadata[$indexMapbenderMetadata]->wms_owner = $row['wms_owner'];
$mapbenderMetadata[$indexMapbenderMetadata]->wfs_owner = $row['wfs_owner'];
@@ -987,6 +1060,7 @@
$mapbenderMetadata[$indexMapbenderMetadata]->maxy = $latlonbbox[3];
}
$indexMapbenderMetadata++;
+ }
}
}
More information about the Mapbender_commits
mailing list