[Mapbender-commits] r9299 - in trunk/mapbender: http/classes http/php resources/db resources/db/pgsql/UTF-8/update
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Oct 21 07:10:36 PDT 2015
Author: armin11
Date: 2015-10-21 07:10:36 -0700 (Wed, 21 Oct 2015)
New Revision: 9299
Added:
trunk/mapbender/resources/db/materialize_dataset_view.sql
Modified:
trunk/mapbender/http/classes/class_metadata_new.php
trunk/mapbender/http/php/mod_callMetadata.php
trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql
Log:
New functions to enable spatial metadata search - not fully implemented - further work has to be done
Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php 2015-10-21 06:57:54 UTC (rev 9298)
+++ trunk/mapbender/http/classes/class_metadata_new.php 2015-10-21 14:10:36 UTC (rev 9299)
@@ -318,7 +318,8 @@
$this->databaseTableName = 'mb_metadata';
//$this->keywordRelation = 'layer_keyword';
//$this->searchView = 'wms_search_table';
- $this->searchView = 'search_dataset_view';
+ //$this->searchView = 'search_dataset_view';
+ $this->searchView = 'dataset_search_table';
$this->whereStrCatExtension = " AND custom_category.custom_category_hidden = 0";
switch ($this->orderBy) {
/*case "rank":
@@ -582,16 +583,16 @@
$datasetMatrix = $this->flipDiagonally($datasetMatrix);
//read out first server entry - maybe this a little bit timeconsuming TODO
for($i=0; $i<count($datasetMatrix);$i++){
- $this->datasetJSON->dataset->srv[$i]->id = $datasetMatrix[$i]['metadata_id'];
+ $this->datasetJSON->dataset->srv[$i]->id = $datasetMatrix[$i]['dataset_id'];
$this->datasetJSON->dataset->srv[$i]->title = $datasetMatrix[$i]['title'];
- $this->datasetJSON->dataset->srv[$i]->abstract = $datasetMatrix[$i]['abstract'];
- $this->datasetJSON->dataset->srv[$i]->date = date("d.m.Y",$datasetMatrix[$i]['last_changed']);
+ $this->datasetJSON->dataset->srv[$i]->abstract = $datasetMatrix[$i]['dataset_abstract'];
+ $this->datasetJSON->dataset->srv[$i]->date = date("d.m.Y",$datasetMatrix[$i]['dataset_timestamp']);
$this->datasetJSON->dataset->srv[$i]->respOrg = $datasetMatrix[$i]['mb_group_name'];
$this->datasetJSON->dataset->srv[$i]->logoUrl = $datasetMatrix[$i]['mb_group_logo_path'];
//TODO: other url - to metadata uuid!
- $this->datasetJSON->dataset->srv[$i]->mdLink = "http://".$this->hostName."/mapbender/php/mod_showMetadata.php?languageCode=".$this->languageCode."&resource=wmc&layout=tabs&id=".$datasetMatrix[$i]['metadata_id'];
+ $this->datasetJSON->dataset->srv[$i]->mdLink = "http://".$this->hostName."/mapbender/php/mod_iso19139ToHtml.php?url=".urlencode("http://".$this->hostName."/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=").$datasetMatrix[$i]['fileidentifier'];
//TODO: preview?
- $this->datasetJSON->dataset->srv[$i]->previewURL = "http://".$this->hostName."/mapbender/geoportal/mod_showPreview.php?resource=wmc&id=".$datasetMatrix[$i]['wmc_id'];
+ $this->datasetJSON->dataset->srv[$i]->previewURL = $datasetMatrix[$i]['preview_url'];
$spatialSource = "";
$stateOrProvince = $datasetMatrix[$i]['mb_group_stateorprovince'];
if ($stateOrProvince == "NULL" || $stateOrProvince == "") {
Modified: trunk/mapbender/http/php/mod_callMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callMetadata.php 2015-10-21 06:57:54 UTC (rev 9298)
+++ trunk/mapbender/http/php/mod_callMetadata.php 2015-10-21 14:10:36 UTC (rev 9299)
@@ -338,7 +338,7 @@
for($i=0; $i<count($testArray);$i++){
if (!($testArray[$i] == 'wms' or $testArray[$i] == 'wfs' or $testArray[$i] == 'wmc' or $testArray[$i] == 'dataset')) {
//echo 'searchResources: <b>'.$testMatch.'</b>at least one of them does not exists!<br/>';
- echo 'Parameter <b>searchResources</b>at least one of them does not exists! (wms,wfs,wmc,data)<br/>';
+ echo 'Parameter <b>searchResources</b>at least one of them does not exists! (wms,wfs,wmc,dataset)<br/>';
die();
}
}
Added: trunk/mapbender/resources/db/materialize_dataset_view.sql
===================================================================
--- trunk/mapbender/resources/db/materialize_dataset_view.sql (rev 0)
+++ trunk/mapbender/resources/db/materialize_dataset_view.sql 2015-10-21 14:10:36 UTC (rev 9299)
@@ -0,0 +1,44 @@
+DROP TABLE IF EXISTS dataset_search_table_tmp;
+select * into dataset_search_table_tmp from search_dataset_view;
+
+
+DROP TABLE IF EXISTS dataset_search_table;
+
+ALTER TABLE dataset_search_table_tmp RENAME TO dataset_search_table;
+
+UPDATE dataset_search_table SET load_count=0 WHERE load_count is NULL;
+
+-- Index: gist_wst_dataset_the_geom
+
+-- DROP INDEX gist_wst_dataset_the_geom;
+
+CREATE INDEX gist_wst_dataset_the_geom
+ ON dataset_search_table
+ USING gist
+ (the_geom);
+
+-- Index: idx_wst_dataset_department
+
+-- DROP INDEX idx_wst_dataset_department;
+
+CREATE INDEX idx_wst_dataset_department
+ ON dataset_search_table
+ USING btree
+ (department);
+-- Index: idx_wst_dataset_md_topic_cats
+
+-- DROP INDEX idx_wst_dataset_md_topic_cats;
+
+CREATE INDEX idx_wst_dataset_md_topic_cats
+ ON dataset_search_table
+ USING btree
+ (md_topic_cats);
+-- Index: idx_wst_dataset_dataset_id
+
+-- DROP INDEX idx_wst_dataset_dataset_id;
+
+CREATE INDEX idx_wst_dataset_dataset_id
+ ON dataset_search_table
+ USING btree
+ (dataset_id);
+
Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql 2015-10-21 06:57:54 UTC (rev 9298)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql 2015-10-21 14:10:36 UTC (rev 9299)
@@ -633,3 +633,20 @@
ALTER TABLE search_wms_view
OWNER TO postgres;
+DROP VIEW search_dataset_view;
+
+CREATE OR REPLACE VIEW search_dataset_view AS
+ SELECT dataset_dep.fkey_mb_user_id AS user_id, dataset_dep.dataset_id, dataset_dep.srs AS dataset_srs, dataset_dep.title, dataset_dep.abstract AS dataset_abstract, f_collect_searchtext_dataset(dataset_dep.dataset_id) AS searchtext, dataset_dep.dataset_timestamp, dataset_dep.department, dataset_dep.mb_group_name, dataset_dep.mb_group_title, dataset_dep.mb_group_country, 0 AS load_count, dataset_dep.mb_group_stateorprovince, f_collect_inspire_cat_dataset(dataset_dep.dataset_id) AS md_inspire_cats, f_collect_custom_cat_dataset(dataset_dep.dataset_id) AS md_custom_cats, f_collect_topic_cat_dataset(dataset_dep.dataset_id) AS md_topic_cats, dataset_dep.bbox as the_geom, (ST_XMin(dataset_dep.bbox)::text || ','::text || ST_YMin(dataset_dep.bbox)::text || ','::text || ST_XMax(dataset_dep.bbox)::text || ','::text || ST_YMax(dataset_dep.bbox)::text) as bbox, dataset_dep.preview_url, dataset_dep.fileidentifier, dataset_dep.mb_group_logo_path
+ FROM ( SELECT mb_metadata.the_geom AS bbox, mb_metadata.ref_system AS srs, mb_metadata.metadata_id AS dataset_id, mb_metadata.title, mb_metadata.abstract, mb_metadata.lastchanged AS dataset_timestamp, mb_metadata.uuid as fileidentifier, mb_metadata.preview_image as preview_url, mb_metadata.fkey_mb_user_id, user_dep.mb_group_id AS department, user_dep.mb_group_name, user_dep.mb_group_title, user_dep.mb_group_country, user_dep.mb_group_stateorprovince, user_dep.mb_group_logo_path
+ FROM ( SELECT registrating_groups.fkey_mb_user_id AS mb_user_id, mb_group.mb_group_id, mb_group.mb_group_name, mb_group.mb_group_title, mb_group.mb_group_country, mb_group.mb_group_stateorprovince, mb_group.mb_group_logo_path
+ FROM registrating_groups, mb_group
+ WHERE registrating_groups.fkey_mb_group_id = mb_group.mb_group_id) user_dep, mb_metadata
+ WHERE user_dep.mb_user_id = mb_metadata.fkey_mb_user_id AND mb_metadata.the_geom IS NOT NULL) dataset_dep
+ ORDER BY dataset_dep.dataset_id;
+
+ALTER TABLE search_dataset_view
+ OWNER TO postgres;
+
+DROP TABLE IF EXISTS dataset_search_table;
+SELECT * INTO dataset_search_table FROM search_dataset_view;
+
More information about the Mapbender_commits
mailing list