[fusion-commits] r1350 - branches/fusion-1.0/MapServer/php

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Mar 28 14:54:15 EDT 2008


Author: Assefa
Date: 2008-03-28 14:54:15 -0400 (Fri, 28 Mar 2008)
New Revision: 1350

Modified:
   branches/fusion-1.0/MapServer/php/Measure.php
Log:
Do not use geos for distance meanure #44

Modified: branches/fusion-1.0/MapServer/php/Measure.php
===================================================================
--- branches/fusion-1.0/MapServer/php/Measure.php	2008-03-28 18:53:24 UTC (rev 1349)
+++ branches/fusion-1.0/MapServer/php/Measure.php	2008-03-28 18:54:15 UTC (rev 1350)
@@ -48,19 +48,14 @@
     if (isset($_SESSION['maps']) && isset($_SESSION['maps'][$mapName])) {
         $oMap = ms_newMapObj($_SESSION['maps'][$mapName]);
     }
-    $shapeObj = ms_newShapeObj(MS_SHAPE_LINE);
-    $lineObj = ms_newLineObj();
-    $lineObj->addXY($x1,$y1);
-    $lineObj->addXY($x2,$y2);
-    $shapeObj->add($lineObj);
     if ($oMap->units == MS_DD)
       /*this already returns a meter*/
       $distance = distHaversine($x1,$y1, $x2,$y2);
     else
-    {
-      $distance = $shapeObj->getLength($shapeObj);
-      /*convert to meter*/
-      $distance = GetMetersPerUnit($oMap->units)*$distance;
+    {   
+        $distance = sqrt (pow(($x2 - $x1),2) + pow(($y2 - $y1),2));
+        /*convert to meter*/
+        $distance = GetMetersPerUnit($oMap->units)*$distance;
     }
       
     header('Content-type: text/x-json');



More information about the fusion-commits mailing list