[Mapbender-commits] r6281 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Jun 17 03:23:08 EDT 2010
Author: kmq
Date: 2010-06-17 07:23:08 +0000 (Thu, 17 Jun 2010)
New Revision: 6281
Added:
trunk/mapbender/http/php/intersection.php
Log:
added intersect script for click detection
Added: trunk/mapbender/http/php/intersection.php
===================================================================
--- trunk/mapbender/http/php/intersection.php (rev 0)
+++ trunk/mapbender/http/php/intersection.php 2010-06-17 07:23:08 UTC (rev 6281)
@@ -0,0 +1,41 @@
+<?php
+require dirname(__FILE__) . "/../../core/globalSettings.php" ;
+$request = new AjaxResponse($_REQUEST);
+$method = $request->getMethod();
+
+try{
+switch ($method) {
+
+ case "intersect":
+ $geometries = $request->getParameter("geometries");
+ $clickPoint = $request->getparameter("clickPoint");
+ $resultGeometries = array();
+
+ $i = 0;
+ foreach($geometries as $geometry){
+ $sql = "SELECT ST_Intersects ('$clickPoint'::geometry, '$geometry'::geometry);";
+ $dbresult = db_query($sql);
+ $row = db_fetch_array($dbresult);
+ $result = $row["st_intersects"] == "f" ? false : true;
+ if($result){
+ $resultGeometries[$i] = $geometry;
+ }
+ $i++;
+ }
+
+ $request->setSuccess(true);
+ $request->setResult(array("geometries" => $resultGeometries));
+ break;
+
+ default:
+ $e = new mb_exception(__FILE__ . ": RPC called with invalid Method '$method'");
+ $request->setSuccess(false);
+ $request->setMessage(__FILE__ . ": RPC called with invalid Method '$method'");
+}
+}catch(Exception $E){
+ $e = new mb_exception(__FILE__ . ": RPC failed. Exception: '$E'");
+ $request->setSuccess(false);
+ $request->setMessage(__FILE__ . ": RPC failed. Exception: '$E'");
+}
+$request->send();
+?>
More information about the Mapbender_commits
mailing list