[Mapbender-commits] r10159 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Jun 26 06:25:30 PDT 2019
Author: armin11
Date: 2019-06-26 06:25:30 -0700 (Wed, 26 Jun 2019)
New Revision: 10159
Modified:
trunk/mapbender/http/php/mod_callCswMetadata.php
Log:
Fix for spatial search (bbox filter) via csw
Modified: trunk/mapbender/http/php/mod_callCswMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callCswMetadata.php 2019-06-26 12:20:04 UTC (rev 10158)
+++ trunk/mapbender/http/php/mod_callCswMetadata.php 2019-06-26 13:25:30 UTC (rev 10159)
@@ -264,7 +264,7 @@
echo 'Parameter <b>searchTypeBbox</b> is not valid (inside,outside,intersects).<br/>';
die();
}
- $searchTypeBbox = $testMatch; //TODO activate this
+ $searchTypeBbox = $testMatch;
$testMatch = NULL;
}
/*if (isset($_REQUEST["accessRestrictions"]) & $_REQUEST["accessRestrictions"] != "") {
@@ -484,26 +484,26 @@
// $queryText = '';
//} else {
-/*if (count($searchTextArray) > 1) {
+if (count($searchTextArray) > 1) {
$fullTextFilter = "<ogc:And>";
} else {
$fullTextFilter = "";
-}*/
-$fullTextFilter = "";
-//foreach($searchTextArray as $queryString) {
+}
+//$fullTextFilter = "";
+foreach($searchTextArray as $queryString) {
$fullTextFilter .= '<ogc:PropertyIsLike wildCard="*" singleChar="_" escapeChar="">';
$fullTextFilter .= '<ogc:PropertyName>AnyText</ogc:PropertyName>';
/*if($queryString != '*'){
$queryString = '*' . explode($queryString) . '*';
}*/
- $queryString = '*' . implode("*", $searchTextArray) . '*';
- $fullTextFilter .= '<ogc:Literal>'.$queryString.'</ogc:Literal>';
+ //$queryString = '*' . implode("*", $searchTextArray) . '*';
+ $fullTextFilter .= '<ogc:Literal>'.$queryString.'*</ogc:Literal>';
$fullTextFilter .= '</ogc:PropertyIsLike>';
-//}
+}
-/*if (count($searchTextArray) > 1) {
+if (count($searchTextArray) > 1) {
$fullTextFilter .= "</ogc:And>";
-}*/
+}
/*
$fullTextFilter .= '<ogc:PropertyIsLike wildCard="%" singleChar="_" escapeChar="">';
$fullTextFilter .= '<ogc:PropertyName>AnyText</ogc:PropertyName>';
@@ -513,10 +513,11 @@
//}
$existsSpatialFilter = false;
$searchBboxArray = explode(",", $searchBbox);
+//TODO: test the right filter!
if ($searchBbox !== NULL) {
$existsSpatialFilter = true;
switch ($searchTypeBbox) {
- case "intersect":
+ case "intersects":
$spatialFilter .= "<ogc:BBOX>";
break;
case "inside":
@@ -529,10 +530,10 @@
$spatialFilter .= "<ogc:BBOX>";
}
$spatialFilter .= "<ogc:PropertyName>BoundingBox</ogc:PropertyName>";
- $spatialFilter .= "<gml:Envelope>";
- $spatialFilter .= "<gml:lowerCorner>".$searchBboxArray[0]." ".$searchBboxArray[1]."</gml:lowerCorner>";
- $spatialFilter .= "<gml:upperCorner>".$searchBboxArray[2]." ".$searchBboxArray[3]."</gml:upperCorner>";
- $spatialFilter .= "</gml:Envelope>";
+ $spatialFilter .= '<gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">';
+ $spatialFilter .= '<gml:coordinates decimal="." cs="," ts=" ">';
+ $spatialFilter .= $searchBboxArray[0].','.$searchBboxArray[1].' '.$searchBboxArray[2].','.$searchBboxArray[3];
+ $spatialFilter .= '</gml:coordinates></gml:Box>';
switch ($searchTypeBbox) {
case "intersect":
$spatialFilter .= "</ogc:BBOX>";
@@ -544,12 +545,12 @@
$spatialFilter .= "</ogc:Disjoint>";
break;
default:
- $spatialFilter .= "/<ogc:BBOX>";
+ $spatialFilter .= "</ogc:BBOX>";
}
}
-
//combine filter
//$e = new mb_exception("fullTextFilter: ".$fullTextFilter);
+
if ($existsSpatialFilter == true && $searchText !== '' && $searchText !== '*'){
$additionalFilter = "<ogc:And>".$fullTextFilter.$spatialFilter."</ogc:And>";
} else {
@@ -559,8 +560,8 @@
$additionalFilter = $fullTextFilter;
}
}
+//$e = new mb_exception("additionalFilter: ".$additionalFilter);
-
//csw Id = catalogueId
$csw = new csw();
$csw->createCatObjFromDB($catalogueId);
More information about the Mapbender_commits
mailing list