[Mapbender-commits] r9323 - in trunk/mapbender/http: classes php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Dec 1 02:47:12 PST 2015
Author: armin11
Date: 2015-12-01 02:47:12 -0800 (Tue, 01 Dec 2015)
New Revision: 9323
Modified:
trunk/mapbender/http/classes/class_iso19139.php
trunk/mapbender/http/php/mod_inspireDownloadFeed.php
Log:
Bugfix for inspire atom feeds - use xmin instead of bbox2d for geometric extent of metadata!
Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php 2015-11-27 10:12:31 UTC (rev 9322)
+++ trunk/mapbender/http/classes/class_iso19139.php 2015-12-01 10:47:12 UTC (rev 9323)
@@ -912,7 +912,7 @@
}
public function createFromDBInternalId($metadataId){
- $sql = "SELECT * , box2d(the_geom) as bbox2d, st_asgml(3,bounding_geom) as bounding_polygon from mb_metadata WHERE metadata_id = $1";
+ $sql = "SELECT * , st_xmin(the_geom) || ',' || st_ymin(the_geom) || ',' || st_xmax(the_geom) || ',' || st_ymax(the_geom) as bbox2d, st_asgml(3,bounding_geom) as bounding_polygon from mb_metadata WHERE metadata_id = $1";
$v = array($metadataId);
$t = array('i');
$res = db_prep_query($sql,$v,$t);
@@ -930,7 +930,7 @@
$this->datasetId = $row['datasetid'];
$this->datasetIdCodeSpace = $row['datasetid_codespace'];
if (isset($row['bbox2d']) && $row['bbox2d'] != '') {
- $bbox = str_replace(' ',',',str_replace(')','',str_replace('BOX(','',$row['bbox2d'])));
+ $bbox = $row['bbox2d'];
//$e = new mb_exception("class_iso19139.php: got bbox for metadata: ".$bbox);
$this->wgs84Bbox = explode(',',$bbox);
}
@@ -1785,6 +1785,7 @@
$this->fees,
$this->licenseSourceNote
);
+ $e = new mb_exception("class_iso19139: ".$this->createWktBboxFromArray($this->wgs84Bbox));
$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s');
$res = db_prep_query($sql,$v,$t);
return $res;
Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php 2015-11-27 10:12:31 UTC (rev 9322)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php 2015-12-01 10:47:12 UTC (rev 9323)
@@ -571,25 +571,25 @@
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.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, box2d(mb_metadata.the_geom) as metadata_bbox, mb_metadata.bounding_geom as polygon, 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, mb_metadata.lastchanged as md_timestamp 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.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, st_xmin(mb_metadata.the_geom) || ',' || st_ymin(mb_metadata.the_geom) || ',' || st_xmax(mb_metadata.the_geom) || ',' || st_ymax(mb_metadata.the_geom) as metadata_bbox, mb_metadata.bounding_geom as polygon, 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, mb_metadata.lastchanged as md_timestamp 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;
$generateFromDataurl = true;
break;
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,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, box2d(mb_metadata.the_geom) as metadata_bbox, mb_metadata.bounding_geom as polygon, 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, mb_metadata.lastchanged as md_timestamp 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 l
ayer_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, st_xmin(mb_metadata.the_geom) || ',' || st_ymin(mb_metadata.the_geom) || ',' || st_xmax(mb_metadata.the_geom) || ',' || st_ymax(mb_metadata.the_geom) as metadata_bbox, mb_metadata.bounding_geom as polygon, 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, mb_metadata.lastchanged as md_timestamp 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 = m
b_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;
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,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, box2d(mb_metadata.the_geom) as metadata_bbox, mb_metadata.bounding_geom as polygon, 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, mb_metadata.lastchanged as md_timestamp 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 joi
n mb_metadata on featuretype_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as featuretype_data inner join wfs on featuretype_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, st_xmin(mb_metadata.the_geom) || ',' || st_ymin(mb_metadata.the_geom) || ',' || st_xmax(mb_metadata.the_geom) || ',' || st_ymax(mb_metadata.the_geom) as metadata_bbox, mb_metadata.bounding_geom as polygon, 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, mb_metadata.lastchanged as md_timestamp from (select * from wfs_featuretype inner join ows_relatio
n_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 featuretype_data.fkey_wfs_id = wfs.wfs_id where wfs.wfs_id = $2;
SQL;
break;
case "metadata":
$sql = <<<SQL
-select 'metadata' as origin,mb_metadata.metadata_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, box2d(mb_metadata.the_geom) as metadata_bbox, mb_metadata.bounding_geom as polygon, 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, mb_metadata.fkey_mb_user_id, mb_metadata.lastchanged as md_timestamp, box2d(the_geom) as bbox2d, datalinks, transfer_size FROM mb_metadata where uuid = $1 and inspire_download = 1;
+select 'metadata' as origin,mb_metadata.metadata_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, st_xmin(mb_metadata.the_geom) || ',' || st_ymin(mb_metadata.the_geom) || ',' || st_xmax(mb_metadata.the_geom) || ',' || st_ymax(mb_metadata.the_geom) as metadata_bbox, mb_metadata.bounding_geom as polygon, 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, mb_metadata.fkey_mb_user_id, mb_metadata.lastchanged as md_timestamp, st_xmin(the_geom) || ',' || st_ymin(the_geom) || ',' || st_xmax(the_geom) || ',' || st_ymax(the_geom) as bbox2d, datalinks, transfer_size FROM mb_metadata where uuid = $1 and inspire_download = 1;
SQL;
break;
case "all":
@@ -1315,7 +1315,7 @@
$e = new mb_notice("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 = rawurlencode($bboxFilter);
+ $bboxFilter = urlencode($bboxFilter);
$gFLink = $mapbenderMetadata[$i]->wfs_getfeature."SERVICE=WFS&REQUEST=GetFeature&VERSION=";
$gFLink .= $mapbenderMetadata[$i]->wfs_version."&typeName=".$mapbenderMetadata[$i]->featuretype_name;
@@ -1685,7 +1685,8 @@
function parseBox2d($box2d) {
//"BOX(6.9213399887085 50.1331939697266,6.93241024017334 50.138801574707)"
//delete BOX( and ), replace , with blank
- $bbox = str_replace(","," ",str_replace(")","",str_replace("BOX(", "", $box2d)));
+ //new 20151201 - use xmin not bbox2d from postgis!!!
+ //$bbox = str_replace(","," ",str_replace(")","",str_replace("BOX(", "", $box2d)));
//explode with blank
$bbox = explode(" ",$bbox);
return $bbox;
@@ -1735,7 +1736,8 @@
$mapbenderMetadata[$indexMapbenderMetadata]->origin = $row['origin'];
$e = new mb_exception($row['origin']);
if (isset($row['bbox2d']) && $row['bbox2d'] != '') {
- $bbox = str_replace(' ',',',str_replace(')','',str_replace('BOX(','',$row['bbox2d'])));
+ $bbox = $row['bbox2d'];
+ //$bbox = str_replace(' ',',',str_replace(')','',str_replace('BOX(','',$row['bbox2d'])));
//$e = new mb_exception("class_iso19139.php: got bbox for metadata: ".$bbox);
$mapbenderMetadata[$indexMapbenderMetadata]->latlonbbox = explode(',',$bbox);
$mapbenderMetadata[$indexMapbenderMetadata]->minx = $mapbenderMetadata[$indexMapbenderMetadata]->latlonbbox[0];
More information about the Mapbender_commits
mailing list